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 f1a3796f..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 @@ -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))); + return Math.ceil(sumOfAssignmentWeights) !== 100.0 ? { assignmentWightsSumError: true } : null; } if (partitions.length < 1) { return { partitionCountError: true }; diff --git a/projects/abtesting/src/favicon.ico b/projects/abtesting/src/favicon.ico index 9beb3ac4..38d45ec9 100644 Binary files a/projects/abtesting/src/favicon.ico and b/projects/abtesting/src/favicon.ico differ