Skip to content

Commit

Permalink
Merge branch 'enhancement/disable-input-fields-for-enabled-feature-fl…
Browse files Browse the repository at this point in the history
…ag' of https://github.com/CarnegieLearningWeb/UpGrade into enhancement/disable-input-fields-for-enabled-feature-flag
  • Loading branch information
Yagnik56 committed Nov 25, 2024
2 parents dcecbe3 + 9efe58d commit 4a4a569
Show file tree
Hide file tree
Showing 20 changed files with 107 additions and 38 deletions.
2 changes: 1 addition & 1 deletion backend/packages/Upgrade/.env.docker.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ CLIENT_API_SECRET=secret
CLIENT_API_KEY=key

CONTEXT_METADATA={"context_identifier_1":{"CONDITIONS":["potential-condition-1","potential-condition-2"],"GROUP_TYPES":["client_group_identifier_1","client_group_identifier_2","client_group_identifier_3"],"EXP_IDS":["decision_point_target_identifier_1","decision_point_target_identifier_2"],"EXP_POINTS":["decision_point_site_identifier_1","decision_point_site_identifier_2"]}}
METRICS=[{"metrics":[{"metric": "totalTimeSeconds","datatype": "continuous"}, {"groupClass":"masteryWorkspace","allowedKeys":["calculating_area_various_figures","Compare_functions_diff_reps_quadratic"],"attributes":[{"metric":"timeSeconds","datatype":"continuous"}]}],"contexts": ["context_identifier_1"]}]
METRICS=[{"metrics":[{"metric": "totalTimeSeconds","datatype": "continuous"}, {"groupClass":"masteryWorkspace","allowedKeys":["calculating_area_various_figures","Compare_functions_diff_reps_quadratic"],"attributes":[{"metric":"timeSeconds","datatype":"continuous"}]}],"contexts": ["context_identifier_1"]}]
2 changes: 1 addition & 1 deletion backend/packages/Upgrade/src/api/DTO/ExperimentDTO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export class ConditionValidator {
@IsOptional()
@ValidateNested({ each: true })
@Type(() => LevelCombinationElementValidator)
public levelCombinationElements: LevelCombinationElementValidator[];
public levelCombinationElements?: LevelCombinationElementValidator[];
}
export class PartitionValidator {
@IsNotEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
checkExperimentAssignedIsNotDefault,
} from '../../utils/index';
import { experimentUsers } from '../../mockData/experimentUsers/index';
import { EXPERIMENT_STATE, ENROLLMENT_CODE } from 'upgrade_types';
import { EXPERIMENT_STATE, ENROLLMENT_CODE, ASSIGNMENT_UNIT } from 'upgrade_types';
import { UpgradeLogger } from '../../../../src/lib/logger/UpgradeLogger';
import { CheckService } from '../../../../src/api/services/CheckService';

Expand Down Expand Up @@ -150,7 +150,7 @@ export default async function testCase(): Promise<void> {
])
);

experimentObject.assignmentUnit = "group";
experimentObject.assignmentUnit = ASSIGNMENT_UNIT.GROUP;

await experimentService.update(experimentObject as any, user, new UpgradeLogger());
// change experiment status to Enrolling
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default async function testCase(): Promise<void> {
let individualExclusions = await checkService.getAllIndividualExclusion();
expect(individualExclusions.length).toEqual(1);
// EXCLUDED_DUE_TO_GROUP_LOGIC
experimentObject.state = 'enrolling';
experimentObject.state = EXPERIMENT_STATE.ENROLLING;
experimentObject.experimentSegmentExclusion = {
"segment": {
"id": "1b0c0200-7a15-4e19-8688-f9ac283f18aa",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default async function testCase(): Promise<void> {

let individualExclusions = await checkService.getAllIndividualExclusion();
expect(individualExclusions.length).toEqual(1);
experimentObject.state = 'enrolling';
experimentObject.state = EXPERIMENT_STATE.ENROLLING;
experimentObject.experimentSegmentExclusion = {
"segment": {
"id": "1b0c0200-7a15-4e19-8688-f9ac283f18aa",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default async function testCase(): Promise<void> {
experimentObject.partitions = updateExcludeIfReachedFlag(experimentObject.partitions);

// create experiment
await experimentService.create(experimentObject as any, user, new UpgradeLogger());
await experimentService.create(experimentObject, user, new UpgradeLogger());
const experiments = await experimentService.find(new UpgradeLogger());
expect(experiments).toEqual(
expect.arrayContaining([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default async function testCase(): Promise<void> {
experimentObject.partitions = updateExcludeIfReachedFlag(experimentObject.partitions);

// create experiment
await experimentService.create(experimentObject as any, user, new UpgradeLogger());
await experimentService.create(experimentObject, user, new UpgradeLogger());
const experiments = await experimentService.find(new UpgradeLogger());
expect(experiments).toEqual(
expect.arrayContaining([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default async function ExcludeGroupsA(): Promise<void> {
experimentObject.partitions = updateExcludeIfReachedFlag(experimentObject.partitions);

// create experiment
await experimentService.create(experimentObject as any, user, new UpgradeLogger());
await experimentService.create(experimentObject, user, new UpgradeLogger());
const experiments = await experimentService.find(new UpgradeLogger());
expect(experiments).toEqual(
expect.arrayContaining([
Expand Down Expand Up @@ -141,7 +141,7 @@ export default async function ExcludeGroupsA(): Promise<void> {
},
},
};
await experimentService.update(experimentObject as any, user, new UpgradeLogger());
await experimentService.update(experimentObject, user, new UpgradeLogger());

// check stats
stats = await analyticsService.getDetailEnrollment(experimentId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default async function ExcludeGroupsB(): Promise<void> {
experimentObject.partitions = updateExcludeIfReachedFlag(experimentObject.partitions);

// create experiment
await experimentService.create(experimentObject as any, user, new UpgradeLogger());
await experimentService.create(experimentObject, user, new UpgradeLogger());
const experiments = await experimentService.find(new UpgradeLogger());
expect(experiments).toEqual(
expect.arrayContaining([
Expand Down Expand Up @@ -142,7 +142,7 @@ export default async function ExcludeGroupsB(): Promise<void> {
},
},
};
await experimentService.update(experimentObject as any, user, new UpgradeLogger());
await experimentService.update(experimentObject, user, new UpgradeLogger());

// check stats
stats = await analyticsService.getDetailEnrollment(experimentId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default async function ExcludeGroupsC(): Promise<void> {
experimentObject.partitions = updateExcludeIfReachedFlag(experimentObject.partitions);

// create experiment
await experimentService.create(experimentObject as any, user, new UpgradeLogger());
await experimentService.create(experimentObject, user, new UpgradeLogger());
const experiments = await experimentService.find(new UpgradeLogger());
expect(experiments).toEqual(
expect.arrayContaining([
Expand Down Expand Up @@ -142,7 +142,7 @@ export default async function ExcludeGroupsC(): Promise<void> {
},
},
};
await experimentService.update(experimentObject as any, user, new UpgradeLogger());
await experimentService.update(experimentObject, user, new UpgradeLogger());

// check stats
stats = await analyticsService.getDetailEnrollment(experimentId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default async function ExcludeIndividualsA(): Promise<void> {
experimentObject.partitions = updateExcludeIfReachedFlag(experimentObject.partitions);

// create experiment
await experimentService.create(experimentObject as any, user, new UpgradeLogger());
await experimentService.create(experimentObject, user, new UpgradeLogger());
const experiments = await experimentService.find(new UpgradeLogger());
expect(experiments).toEqual(
expect.arrayContaining([
Expand Down Expand Up @@ -140,7 +140,7 @@ export default async function ExcludeIndividualsA(): Promise<void> {
},
},
};
await experimentService.update(experimentObject as any, user, new UpgradeLogger());
await experimentService.update(experimentObject, user, new UpgradeLogger());

// check stats
stats = await analyticsService.getDetailEnrollment(experimentId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default async function ExcludeIndividualsB(): Promise<void> {
experimentObject.partitions = updateExcludeIfReachedFlag(experimentObject.partitions);

// create experiment
await experimentService.create(experimentObject as any, user, new UpgradeLogger());
await experimentService.create(experimentObject, user, new UpgradeLogger());
const experiments = await experimentService.find(new UpgradeLogger());
expect(experiments).toEqual(
expect.arrayContaining([
Expand Down Expand Up @@ -142,7 +142,7 @@ export default async function ExcludeIndividualsB(): Promise<void> {
},
},
};
await experimentService.update(experimentObject as any, user, new UpgradeLogger());
await experimentService.update(experimentObject, user, new UpgradeLogger());

// check stats
stats = await analyticsService.getDetailEnrollment(experimentId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default async function ExcludeIndividualsC(): Promise<void> {
experimentObject.partitions = updateExcludeIfReachedFlag(experimentObject.partitions);

// create experiment
await experimentService.create(experimentObject as any, user, new UpgradeLogger());
await experimentService.create(experimentObject, user, new UpgradeLogger());
const experiments = await experimentService.find(new UpgradeLogger());
expect(experiments).toEqual(
expect.arrayContaining([
Expand Down Expand Up @@ -139,7 +139,7 @@ export default async function ExcludeIndividualsC(): Promise<void> {
},
},
};
await experimentService.update(experimentObject as any, user, new UpgradeLogger());
await experimentService.update(experimentObject, user, new UpgradeLogger());

// check stats
stats = await analyticsService.getDetailEnrollment(experimentId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default async function ExcludeGroupsC(): Promise<void> {
experimentObject.partitions = updateExcludeIfReachedFlag(experimentObject.partitions);

// create experiment
await experimentService.create(experimentObject as any, user, new UpgradeLogger());
await experimentService.create(experimentObject, user, new UpgradeLogger());
const experiments = await experimentService.find(new UpgradeLogger());
expect(experiments).toEqual(
expect.arrayContaining([
Expand Down Expand Up @@ -139,7 +139,7 @@ export default async function ExcludeGroupsC(): Promise<void> {
},
},
};
await experimentService.update(experimentObject as any, user, new UpgradeLogger());
await experimentService.update(experimentObject, user, new UpgradeLogger());

// check stats
stats = await analyticsService.getDetailEnrollment(experimentId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default async function ExcludeGroupsB(): Promise<void> {
experimentObject.partitions = updateExcludeIfReachedFlag(experimentObject.partitions);

// create experiment
await experimentService.create(experimentObject as any, user, new UpgradeLogger());
await experimentService.create(experimentObject, user, new UpgradeLogger());
const experiments = await experimentService.find(new UpgradeLogger());
expect(experiments).toEqual(
expect.arrayContaining([
Expand Down Expand Up @@ -139,7 +139,7 @@ export default async function ExcludeGroupsB(): Promise<void> {
},
},
};
await experimentService.update(experimentObject as any, user, new UpgradeLogger());
await experimentService.update(experimentObject, user, new UpgradeLogger());

// check stats
stats = await analyticsService.getDetailEnrollment(experimentId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default async function testCase(): Promise<void> {
experimentObject.partitions = updateExcludeIfReachedFlag(experimentObject.partitions);

// create experiment
await experimentService.create(experimentObject as any, user, new UpgradeLogger());
await experimentService.create(experimentObject, user, new UpgradeLogger());
const experiments = await experimentService.find(new UpgradeLogger());
expect(experiments).toEqual(
expect.arrayContaining([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default async function testCase(): Promise<void> {
experimentObject.partitions = updateExcludeIfReachedFlag(experimentObject.partitions);

// create experiment
await experimentService.create(experimentObject as any, user, new UpgradeLogger());
await experimentService.create(experimentObject, user, new UpgradeLogger());
const experiments = await experimentService.find(new UpgradeLogger());
expect(experiments).toEqual(
expect.arrayContaining([
Expand Down
Loading

0 comments on commit 4a4a569

Please sign in to comment.