From fd6820831565363903c95eeb98723fe3c0f55d45 Mon Sep 17 00:00:00 2001 From: RidhamShah Date: Mon, 4 Mar 2024 10:20:31 +0530 Subject: [PATCH] solving preview user validations --- .../src/api/controllers/validators/PreviewUserValidator.ts | 5 ++--- .../Upgrade/src/api/services/ExperimentAssignmentService.ts | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/backend/packages/Upgrade/src/api/controllers/validators/PreviewUserValidator.ts b/backend/packages/Upgrade/src/api/controllers/validators/PreviewUserValidator.ts index 154fd5b988..84e730ab3e 100644 --- a/backend/packages/Upgrade/src/api/controllers/validators/PreviewUserValidator.ts +++ b/backend/packages/Upgrade/src/api/controllers/validators/PreviewUserValidator.ts @@ -1,11 +1,10 @@ -import { IsNotEmpty, IsDefined, ValidateNested, IsOptional, IsString, IsArray } from 'class-validator'; +import { ValidateNested, IsOptional, IsString, IsArray } from 'class-validator'; import { Type } from 'class-transformer'; import { Experiment } from '../../../../src/api/models/Experiment'; import { ExperimentCondition } from '../../../../src/api/models/ExperimentCondition'; class ExplicitIndividualAssignment { - @IsNotEmpty() - @IsDefined() + @IsOptional() @IsString() public id: string; diff --git a/backend/packages/Upgrade/src/api/services/ExperimentAssignmentService.ts b/backend/packages/Upgrade/src/api/services/ExperimentAssignmentService.ts index 26aca8cc81..f18472a937 100644 --- a/backend/packages/Upgrade/src/api/services/ExperimentAssignmentService.ts +++ b/backend/packages/Upgrade/src/api/services/ExperimentAssignmentService.ts @@ -573,7 +573,7 @@ export class ExperimentAssignmentService { // Create new filtered experiment const alreadyAssignedExperiment = experimentPools.map((pool) => { return pool.filter((experiment) => { - const individualEnrollment = individualEnrollments.find((enrollment) => { + const individualEnrollment = mergedIndividualAssignment.find((enrollment) => { return enrollment.experiment.id === experiment.id; }); const groupEnrollment = groupEnrollments.find((enrollment) => {