Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6770877

Browse files
committed
debug: add console logs for placeholder and parent object in ScoreCampaigns and utils
1 parent 1187979 commit 6770877

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

packages/plugin-loyalties-api/src/models/ScoreCampaigns.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,8 @@ export const loadScoreCampaignClass = (models: IModels, subdomain: string) => {
301301
);
302302
}
303303

304+
console.log({ placeholder });
305+
304306
const changeScore = (eval(placeholder) || 0) * Number(currencyRatio) || 0;
305307
if (!changeScore) {
306308
return;

packages/plugin-loyalties-api/src/models/utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,12 +460,14 @@ export const resolvePlaceholderValue = (target: any, attribute: string) => {
460460
const [propertyName, valueToCheck, valueField] = attribute.split("-");
461461

462462
const parent = target[propertyName] || {};
463+
console.log({ parent });
463464
// Case 1: customer-customFieldsData-1 (look up in customFieldsData)
464465
if (valueToCheck?.includes("customFieldsData")) {
465466
const fieldId = attribute.split(".").pop(); // extract the field number after '.'
466467
const obj = (parent?.customFieldsData || []).find(
467468
(item: any) => item?.field === fieldId
468469
);
470+
console.log({ obj });
469471
return obj?.value ?? "0";
470472
}
471473

0 commit comments

Comments
 (0)