From a7dc072acea4f160a8b3db23e6bfe5bc7b4b060c Mon Sep 17 00:00:00 2001 From: RidhamShah Date: Wed, 11 Oct 2023 10:34:32 +0530 Subject: [PATCH] solved segments having null error --- .../import-experiment.component.ts | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/frontend/projects/upgrade/src/app/features/dashboard/home/components/modal/import-experiment/import-experiment.component.ts b/frontend/projects/upgrade/src/app/features/dashboard/home/components/modal/import-experiment/import-experiment.component.ts index abb0a082bc..1dc26b972d 100644 --- a/frontend/projects/upgrade/src/app/features/dashboard/home/components/modal/import-experiment/import-experiment.component.ts +++ b/frontend/projects/upgrade/src/app/features/dashboard/home/components/modal/import-experiment/import-experiment.component.ts @@ -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: @@ -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) { @@ -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; }