diff --git a/.circleci/config.yml b/.circleci/config.yml index 39491dc2..841d3910 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -83,6 +83,7 @@ workflows: branches: only: - dev + - fix/template - "build-qa": context: org-global diff --git a/src/common/phase-helper.js b/src/common/phase-helper.js index 8e00312a..231991fe 100644 --- a/src/common/phase-helper.js +++ b/src/common/phase-helper.js @@ -25,6 +25,7 @@ class ChallengePhaseHelper { throw new errors.BadRequestError(`Invalid timeline template ID: ${timelineTemplateId}`); } const { timelineTempate } = await this.getTemplateAndTemplateMap(timelineTemplateId); + console.log("Selected timeline template", JSON.stringify(timelineTempate)); const { phaseDefinitionMap } = await this.getPhaseDefinitionsAndMap(); let fixedStartDate = undefined; const finalPhases = _.map(timelineTempate, (phaseFromTemplate) => { @@ -202,17 +203,19 @@ class ChallengePhaseHelper { } async getTemplateAndTemplateMap(timelineTemplateId) { - if (_.isEmpty(this.timelineTemplateMap)) { + if (_.isEmpty(this.timelineTemplateMap[timelineTemplateId])) { const records = await timelineTemplateService.getTimelineTemplate(timelineTemplateId); - const map = new Map(); _.each(records.phases, (r) => { map.set(r.phaseId, r); }); - this.timelineTemplateMap = { timelineTempate: records.phases, timelineTemplateMap: map }; + this.timelineTemplateMap[timelineTemplateId] = { + timelineTempate: records.phases, + timelineTemplateMap: map, + }; } - return this.timelineTemplateMap; + return this.timelineTemplateMap[timelineTemplateId]; } }