Skip to content

Commit

Permalink
solved srs bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
RidhamShah committed Sep 25, 2023
1 parent 35fe86e commit 4caf928
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export class StratificationController {
@UseBefore(upload.single('file'))
public insertStratification(@Req() request: AppRequest): Promise<UserStratificationFactor[]> {
const csvData = request.body[0].file;
const rows = csvData.split('\n');
const rows = csvData.replace(/"/g, '').split('\n');
const columnNames = rows[0].split(',');

const userFactorValues: StratificationInputValidator[] = [];
Expand Down
1 change: 1 addition & 0 deletions backend/packages/Upgrade/src/api/models/Experiment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export class Experiment extends BaseModel {

@ManyToOne(() => StratificationFactor, (stratificationFactor) => stratificationFactor.experiment, {
onDelete: 'CASCADE',
nullable: true,
})
public stratificationFactor: StratificationFactor;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ export class ExperimentService {
} = experiment;

// create stratificationFactor is not found
if (!expDoc.stratificationFactor.id) {
if (expDoc.stratificationFactor.id) {
expDoc.stratificationFactor.id = uuid();
await transactionalEntityManager.getRepository(StratificationFactor).save(expDoc.stratificationFactor);
}
Expand Down Expand Up @@ -1141,7 +1141,7 @@ export class ExperimentService {
this.checkConditionCodeDefault(conditions);

// create stratificationFactor is not found
if (!expDoc.stratificationFactor.id) {
if (expDoc.stratificationFactor.id) {
expDoc.stratificationFactor.id = uuid();
await transactionalEntityManager.getRepository(StratificationFactor).save(expDoc.stratificationFactor);
}
Expand Down

0 comments on commit 4caf928

Please sign in to comment.