Skip to content

Commit

Permalink
Moving data and query in within subject code block for latency issue …
Browse files Browse the repository at this point in the history
…in QA (#1062)

* moving data and query in within subject code block for latency issue in qa

* initialize array and cleanup

* comment out within-subjects in UI

---------

Co-authored-by: danoswaltCL <[email protected]>
  • Loading branch information
ppratikcr7 and danoswaltCL authored Oct 13, 2023
1 parent 403da73 commit 347112d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -650,21 +650,23 @@ export class ExperimentAssignmentService {
);
})
);

const allSites = [],
allTargets = [];
filteredExperiments.forEach((exp) => {
exp.partitions.forEach((partition) => {
allSites.push(partition.site);
allTargets.push(partition.target);
let monitoredLogCounts = [];
if (filteredExperiments.some((e) => e.assignmentUnit === ASSIGNMENT_UNIT.WITHIN_SUBJECTS)) {
const allWithinSubjectsSites = [];
const allWithinSubjectsTargets = [];
filteredExperiments.forEach((exp) => {
exp.partitions.forEach((partition) => {
allWithinSubjectsSites.push(partition.site);
allWithinSubjectsTargets.push(partition.target);
});
});
});
const monitoredLogCounts = await this.monitoredDecisionPointLogRepository.getAllMonitoredDecisionPointLog(
userId,
allSites,
allTargets,
logger
);
monitoredLogCounts = await this.monitoredDecisionPointLogRepository.getAllMonitoredDecisionPointLog(
userId,
allWithinSubjectsSites,
allWithinSubjectsTargets,
logger
);
}

return filteredExperiments.reduce((accumulator, experiment, index) => {
const assignment = experimentAssignment[index];
Expand Down Expand Up @@ -765,7 +767,6 @@ export class ExperimentAssignmentService {

private createExperimentPool(experiments: Experiment[]): Experiment[][] {
const pool: Experiment[][] = [];
// const localExperiment = [...experiments];

const decisionPointExperimentMap: Record<string, Experiment[]> = {};

Expand All @@ -782,36 +783,6 @@ export class ExperimentAssignmentService {
pool.push(this.createPool(decisionPointToStart, decisionPointExperimentMap, []));
}

// while (localExperiment.length > 0) {
// const poolElements = [];
// const decisionPointHashMap: Record<string, Experiment[]> = {};

// for (let i = 0; i < localExperiment.length; i++) {
// // Push single element inside the pool
// const experiment = localExperiment[i];
// if (i === 0) {
// poolElements.push(experiment);
// }

// // add to decision point hashmap
// let isIntersecting = false;
// experiment.partitions.forEach((partition) => {
// const partitionId = `${partition.site}_${partition.target}`;
// if (partitionId in decisionPointHashMap) {
// isIntersecting = true;
// }
// decisionPointHashMap[partitionId] = decisionPointHashMap[partitionId] || [];
// decisionPointHashMap[partitionId].push(experiment);
// });

// if(isIntersecting) {

// }
// }

// // remove elements from localExperiment
// }

return pool;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class ExperimentOverviewComponent implements OnInit, OnDestroy {
unitOfAssignments = [
{ value: ASSIGNMENT_UNIT.INDIVIDUAL },
{ value: ASSIGNMENT_UNIT.GROUP },
{ value: ASSIGNMENT_UNIT.WITHIN_SUBJECTS },
// { value: ASSIGNMENT_UNIT.WITHIN_SUBJECTS }, // #1063 temporarily removed within-subjects until solved
];
public ASSIGNMENT_UNIT = ASSIGNMENT_UNIT;

Expand Down

0 comments on commit 347112d

Please sign in to comment.