Skip to content

Commit

Permalink
solve stratificationFactor creating multiple doc
Browse files Browse the repository at this point in the history
  • Loading branch information
RidhamShah committed Sep 21, 2023
1 parent 4a9a921 commit 6ef44ae
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,12 @@ export class StratificationService {
const stratificationFactorRemaining = userStratificationData.filter((factorData) => {
return !stratificationFactorDetials.some((factor) => factor.stratificationFactorName === factorData.factor);
});
const stratificationFactorToSave = [...new Set(stratificationFactorRemaining)].map((stratificationFactor) => {
return { id: uuid(), stratificationFactorName: stratificationFactor.factor };

// create a SET of stratificationFactors not found in DB
const stratificationFactorToSave = [
...new Set(stratificationFactorRemaining.map((stratificationFactor) => stratificationFactor.factor)),
].map((factor) => {
return { id: uuid(), stratificationFactorName: factor };
});

let userDocCreated: ExperimentUser[], stratificationFactorDocCreated: StratificationFactor[];
Expand Down

0 comments on commit 6ef44ae

Please sign in to comment.