on 2019 Jun 03 10:06 PM
Hi all,
I am making a query that brings me a lot of information about the active promotions.
The query is:
SELECT
{pr.startdate} AS 'Data/Hora Inicial',
{pr.enddate} AS 'Data/Hora Final',
{pr.code} AS 'Título',
{rs.code} AS 'Status',
{pr.priority} AS 'Prioridade'
FROM
{
PromotionSourceRule AS pr
JOIN DroolsRule AS dr ON {pr:code} = {dr:code}
JOIN RuleStatus AS rs ON {pr.status} = {rs.pk}
}
WHERE
{pr:enddate} < current_timestamp
AND {dr.active} = '1'
AND {dr.currentversion} = '1'
ORDER BY
{pr.enddate} ASC
But I need to find the Coupon code that triggers these promotions.... How can I join the SingleCodeCoupon at the query??
Thanks all
Request clarification before answering.
Hi Fabio,
CheckDefaultSourceRuleInspector. We extended it to be able to check whether a rule has a coupon condition for a given coupon (couponCode in the fragment). You can then translate this to flex search.
Map<String, RuleConditionDefinitionData> ruleConditionDefinitions =
getRuleConditionsRegistry().getConditionDefinitionsForRuleTypeAsMap(sourceRule.getClass());
List<RuleConditionData>
ruleConditionDatas = getRuleConditionsConverter().fromString(sourceRule.getConditions(), ruleConditionDefinitions);
return collectAll(ruleConditionDatas).anyMatch(c -> {
if (conditionDefinitionId.equals(c.getDefinitionId())) {
RuleParameterData ruleParameterData = c.getParameters().get(parameterName);
if (ruleParameterData != null) {
return StringUtils.contains(ruleParameterData.getValue().toString(), couponCode);
}
}
return false;
});
BR, Cristi C.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.