From a8f0883af83e0ddf0f944124a792812ffffc3fcb Mon Sep 17 00:00:00 2001 From: ppratikcr7 Date: Sat, 6 Mar 2021 00:58:11 +0530 Subject: [PATCH 1/3] fix/issue-109: accepting decimal values for sum of 100 --- .../dashboard/home/validators/experiment-form.validators.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/abtesting/src/app/features/dashboard/home/validators/experiment-form.validators.ts b/projects/abtesting/src/app/features/dashboard/home/validators/experiment-form.validators.ts index f1a3796f..23f0777a 100644 --- a/projects/abtesting/src/app/features/dashboard/home/validators/experiment-form.validators.ts +++ b/projects/abtesting/src/app/features/dashboard/home/validators/experiment-form.validators.ts @@ -12,9 +12,9 @@ export class ExperimentFormValidators { if (conditions.length < 2) { return { conditionCountError: true }; } else if (conditions.length >= 2) { - let sumOfAssignmentWeights = 0; - conditions.forEach(condition => (sumOfAssignmentWeights += parseInt(condition.assignmentWeight, 10))); - return sumOfAssignmentWeights !== 100 ? { assignmentWightsSumError: true } : null; + let sumOfAssignmentWeights = 0.0; + conditions.forEach(condition => (sumOfAssignmentWeights += parseFloat(condition.assignmentWeight, 10.0))); + return sumOfAssignmentWeights !== 100.0 ? { assignmentWightsSumError: true } : null; } if (partitions.length < 1) { return { partitionCountError: true }; From 7d7ad7bd02b7caa0e36e9687acbf7adb85dad6ee Mon Sep 17 00:00:00 2001 From: ppratikcr7 Date: Wed, 10 Mar 2021 19:49:20 +0530 Subject: [PATCH 2/3] fix for issue 109, on uncheck resets weights to 0 by deafult as of now. --- .../experiment-design.component.html | 14 +++++++++++++- .../experiment-design.component.ts | 18 ++++++++++++++++++ .../validators/experiment-form.validators.ts | 4 ++-- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/projects/abtesting/src/app/features/dashboard/home/components/experiment-design/experiment-design.component.html b/projects/abtesting/src/app/features/dashboard/home/components/experiment-design/experiment-design.component.html index f963c2d4..4e4aea5b 100644 --- a/projects/abtesting/src/app/features/dashboard/home/components/experiment-design/experiment-design.component.html +++ b/projects/abtesting/src/app/features/dashboard/home/components/experiment-design/experiment-design.component.html @@ -59,6 +59,7 @@ | translate " formControlName="assignmentWeight" + /> @@ -127,7 +128,18 @@ + {{ 'home.new-experiment.design.add-condition.text' | translate }} - + + + +
+ + Equal Weight Assignment + +
+
+
{ + control.get('assignmentWeight').setValue((100.0/len).toFixed(2)); + }); + } + else { + conditions.controls.forEach( control => { + control.get('assignmentWeight').setValue(0); + }); + } + + } + get condition(): FormArray { return this.experimentDesignForm.get('conditions') as FormArray; diff --git a/projects/abtesting/src/app/features/dashboard/home/validators/experiment-form.validators.ts b/projects/abtesting/src/app/features/dashboard/home/validators/experiment-form.validators.ts index 23f0777a..b8ec2a97 100644 --- a/projects/abtesting/src/app/features/dashboard/home/validators/experiment-form.validators.ts +++ b/projects/abtesting/src/app/features/dashboard/home/validators/experiment-form.validators.ts @@ -13,8 +13,8 @@ export class ExperimentFormValidators { return { conditionCountError: true }; } else if (conditions.length >= 2) { let sumOfAssignmentWeights = 0.0; - conditions.forEach(condition => (sumOfAssignmentWeights += parseFloat(condition.assignmentWeight, 10.0))); - return sumOfAssignmentWeights !== 100.0 ? { assignmentWightsSumError: true } : null; + conditions.forEach(condition => (sumOfAssignmentWeights += parseFloat(condition.assignmentWeight))); + return Math.ceil(sumOfAssignmentWeights) !== 100.0 ? { assignmentWightsSumError: true } : null; } if (partitions.length < 1) { return { partitionCountError: true }; From 73125ba3444b7d7791d081f3f319ed3c5d1b7a1e Mon Sep 17 00:00:00 2001 From: ppratikcr7 Date: Thu, 11 Mar 2021 13:40:02 +0530 Subject: [PATCH 3/3] fix for issue 170, favicon updated --- projects/abtesting/src/favicon.ico | Bin 1150 -> 1141 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/projects/abtesting/src/favicon.ico b/projects/abtesting/src/favicon.ico index 9beb3ac4c26c9e7138a63a2ee513bad272979223..38d45ec9663b856b04a6c96ead1409e61e29973f 100644 GIT binary patch literal 1141 zcmV-*1d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