Skip to content
This repository has been archived by the owner on May 6, 2021. It is now read-only.

Commit

Permalink
fix/issue-111: updated peer review issues and extra changes of #109 r…
Browse files Browse the repository at this point in the history
…emoved
  • Loading branch information
ppratikcr7 committed Mar 11, 2021
1 parent ad5e78d commit 2ee682a
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,7 @@
+ {{ 'home.new-experiment.design.add-condition.text' | translate }}
</button>
</ng-container>
<!-- applyEqualWeight -->
<mat-card class="result">
<mat-card-content>
<section class="example-section">
<mat-checkbox
class="example-margin"
(change)="applyEqualWeight($event)">
Equal Weight Assignment
</mat-checkbox>
</section>
</mat-card-content>
</mat-card>

<!-- Partition Table -->
<ng-container>
<mat-table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,25 +244,6 @@ export class ExperimentDesignComponent implements OnInit, OnChanges, OnDestroy {
return partition;
}

applyEqualWeight(event){
console.log(event.checked);
const conditions = this.experimentDesignForm.get('conditions') as FormArray;

if(event.checked){
const len = conditions.controls.length;
conditions.controls.forEach( control => {
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
<td class="ft-12-600" mat-cell *matCellDef="let experiment">
<span>{{ experiment.postExperimentRule | titlecase }}</span>
<br />
<span class="experiment-revertTo ft-10-400" *ngIf= "experiment.postExperimentRule === 'assign'">
<span class="experiment-revertTo ft-10-400" *ngIf= "experiment.postExperimentRule === ('home-global.post-experiment-rule.assign.text' | translate)">
{{ experiment.revertTo ? getConditionCode(experiment.revertTo, experiment.id) : "(" + ('home-global.post-experiment-rule.default.text' | translate) + ")" }}
</span>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,21 @@
<ng-container
*ngIf="permissions?.experiments.update && experiment.state !== ExperimentState.CANCELLED; else readOnlyRule"
>
<td>
<div class="section-data-value section-data-value--editablediv">
<span
class="ft-18-700 section-data-value section-data-value--editable"
(click)="openDialog(DialogType.CHANGE_POST_EXPERIMENT_RULE)"
>{{ experiment.postExperimentRule | titlecase }}</span>
<mat-icon class="edit-icon" *ngIf="permissions?.experiments.update">create</mat-icon>
<br />
<span class="ft-14-400 experiment-assign" *ngIf= "experiment.postExperimentRule === 'assign'">
</div>
<span class="ft-14-400 experiment-assign" *ngIf= "experiment.postExperimentRule === ('home-global.post-experiment-rule.assign.text' | translate)">
{{ experiment.revertTo ? getConditionCode(experiment.revertTo, experiment.id) : "(" + ('home-global.post-experiment-rule.default.text' | translate) + ")" }}
</span></td>
</span>
</ng-container>
<ng-template #readOnlyRule>
<span class="ft-18-700 section-data-value">{{ experiment.postExperimentRule | titlecase }}</span>
<span class="ft-14-400 experiment-assign" *ngIf= "experiment.postExperimentRule === 'assign'">
<br />
<span class="ft-14-400 experiment-assign" *ngIf= "experiment.postExperimentRule === ('home-global.post-experiment-rule.assign.text' | translate)">
{{ experiment.revertTo ? getConditionCode(experiment.revertTo, experiment.id) : "(" + ('home-global.post-experiment-rule.default.text' | translate) + ")" }}
</span>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ $font-size-small: 15px;
}

&-assign {
display: block;
word-break: break-word;
color: var(--grey-3);
}

Expand All @@ -89,8 +89,9 @@ $font-size-small: 15px;
margin-bottom: 20px;

.experiment-state-container {
flex-direction: column;
display: flex;
align-items: center;
align-items: flex-start;

.state-circle {
display: inline-block;
Expand Down Expand Up @@ -177,6 +178,12 @@ $font-size-small: 15px;
cursor: pointer;
}
}

&--editablediv{
display: flex;
align-items: center;

}
}

&-group {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export class ExperimentFormValidators {
if (conditions.length < 2) {
return { conditionCountError: true };
} else if (conditions.length >= 2) {
let sumOfAssignmentWeights = 0.0;
conditions.forEach(condition => (sumOfAssignmentWeights += parseFloat(condition.assignmentWeight)));
return Math.ceil(sumOfAssignmentWeights) !== 100.0 ? { assignmentWightsSumError: true } : null;
let sumOfAssignmentWeights = 0;
conditions.forEach(condition => (sumOfAssignmentWeights += parseInt(condition.assignmentWeight, 10)));
return sumOfAssignmentWeights !== 100 ? { assignmentWightsSumError: true } : null;
}
if (partitions.length < 1) {
return { partitionCountError: true };
Expand Down
1 change: 1 addition & 0 deletions projects/abtesting/src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"home-global.consistency-rule.text": "Consistency Rule",
"home-global.post-experiment-rule.text": "POST EXPERIMENT RULE",
"home-global.post-experiment-rule.default.text": "default",
"home-global.post-experiment-rule.assign.text": "assign",
"home-global.enrollments-per-custom.text": " per ",
"home-global.assignment-weight.text": "ASSIGNMENT WEIGHT",
"home.experiment.text.subtitle": "Create and analyze experiments",
Expand Down

0 comments on commit 2ee682a

Please sign in to comment.