Browse Source

fix(admin-ui): Correctly save promotion actions

Michael Bromley 7 years ago
parent
commit
34cc34b3ff

+ 4 - 4
admin-ui/src/app/marketing/components/promotion-detail/promotion-detail.component.ts

@@ -147,8 +147,8 @@ export class PromotionDetailComponent extends BaseDetailComponent<AdjustmentSour
                     const input: UpdateAdjustmentSourceInput = {
                         id: promotion.id,
                         name: formValue.name,
-                        conditions: this.mapOperationsToInputs(this.conditions, formValue),
-                        actions: this.mapOperationsToInputs(this.actions, formValue),
+                        conditions: this.mapOperationsToInputs(this.conditions, formValue.conditions),
+                        actions: this.mapOperationsToInputs(this.actions, formValue.actions),
                     };
                     return this.dataService.adjustmentSource.updatePromotion(input);
                 }),
@@ -185,12 +185,12 @@ export class PromotionDetailComponent extends BaseDetailComponent<AdjustmentSour
      */
     private mapOperationsToInputs(
         operations: AdjustmentOperation[],
-        formValue: any,
+        formValueOperations: any,
     ): AdjustmentOperationInput[] {
         return operations.map((o, i) => {
             return {
                 code: o.code,
-                arguments: Object.values(formValue.conditions[i].args).map(v => v.toString()),
+                arguments: Object.values(formValueOperations[i].args).map(v => v.toString()),
             };
         });
     }