Skip to content

Commit

Permalink
solved segments having null error
Browse files Browse the repository at this point in the history
  • Loading branch information
RidhamShah committed Oct 11, 2023
1 parent d8e8517 commit a7dc072
Showing 1 changed file with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { filter } from 'rxjs/operators';
import { v4 as uuidv4 } from 'uuid';
import { MatLegacySnackBar as MatSnackBar } from '@angular/material/legacy-snack-bar';
import { MatLegacyTableDataSource as MatTableDataSource } from '@angular/material/legacy-table';
import { EXPERIMENT_TYPE, FILTER_MODE } from 'upgrade_types';
import { EXPERIMENT_TYPE, FILTER_MODE, SEGMENT_TYPE } from 'upgrade_types';

interface ImportExperimentJSON {
schema:
Expand Down Expand Up @@ -476,6 +476,32 @@ export class ImportExperimentComponent implements OnInit {
return result;
}

deduceParticipants(result) {
if (!result.experimentSegmentInclusion) {
result.experimentSegmentInclusion = {
segment: {
individualForSegment: [],
groupForSegment: [],
subSegments: [],
type: SEGMENT_TYPE.PRIVATE,
},
};
}

if (!result.experimentSegmentExclusion) {
result.experimentSegmentExclusion = {
segment: {
individualForSegment: [],
groupForSegment: [],
subSegments: [],
type: SEGMENT_TYPE.PRIVATE,
},
};
}

return result;
}

updateExperimentJSON(result) {
// adding missing fields:
if (!result.factors) {
Expand All @@ -485,6 +511,7 @@ export class ImportExperimentComponent implements OnInit {
result = this.deduceConditionPayload(result);
result = this.deducePartition(result);
result = this.deduceFactors(result);
result = this.deduceParticipants(result);

return result;
}
Expand Down

0 comments on commit a7dc072

Please sign in to comment.