diff --git a/src/util/LegacyMapper.ts b/src/util/LegacyMapper.ts index db1d444..b0054e7 100644 --- a/src/util/LegacyMapper.ts +++ b/src/util/LegacyMapper.ts @@ -3,7 +3,6 @@ import { PrizeSetTypes } from "../common/Constants"; import { V4_SUBTRACKS, V5_TO_V4 } from "../common/ConversionMap"; import { Challenge_Phase } from "../models/domain-layer/challenge/challenge"; import { legacyChallengeStatusesMap } from "./constants"; -import DateUtil from "./DateUtil"; class LegacyMapper { // To be used on challenge:update calls that change state from New -> Draft @@ -184,13 +183,13 @@ class LegacyMapper { public mapPhases(subTrack: string, phases: Challenge_Phase[]) { return phases.map((phase: Challenge_Phase, index: number) => ({ phaseTypeId: this.mapPhaseNameToPhaseTypeId(phase.name), - phaseStatusId: phase.isOpen ? 2 : 1, // Set Open if phase is open, otherwise mark it Scheduled [1: Scheduled, 2: Open, 3: Closed] - fixedStartTime: phase.name === "Registration" ? DateUtil.formatDateForIfx(phase.scheduledStartDate!) : undefined, // Registration Phase needs a fixedStartTime - scheduledStartTime: DateUtil.formatDateForIfx(phase.scheduledStartDate!), - scheduledEndTime: DateUtil.formatDateForIfx(phase.scheduledEndDate!), - actualStartTime: !phase.actualStartDate ? undefined: DateUtil.formatDateForIfx(phase.actualStartDate) , - actualEndTime: !phase.actualEndDate ? undefined: DateUtil.formatDateForIfx(phase.actualEndDate) , - duration: phase.duration, + phaseStatusId: phase.isOpen ? 2 : phase.actualEndDate ? 3 : 1, + fixedStartTime: !phase.predecessor ? undefined : phase.scheduledStartDate!, + scheduledStartTime: phase.scheduledStartDate!, + scheduledEndTime: phase.scheduledEndDate!, + actualStartTime: !phase.actualStartDate ? undefined : phase.actualStartDate, + actualEndTime: !phase.actualEndDate ? undefined : phase.actualEndDate, + duration: phase.duration * 1000, phaseCriteria: this.mapPhaseCriteria(subTrack, phase), })); } @@ -211,7 +210,7 @@ class LegacyMapper { 1: this.mapScorecard(subTrack, phase.name), // Scorecard ID 2: phase.name === "Registration" ? '1' : undefined, // Registration Number 3: phase.name === "Submission" ? submissionPhaseConstraint?.value.toString() ?? // if we have a submission phase constraint use it - reviewPhaseConstraint?.value != null ? '1' : undefined // otherwise if we have a review phase constraint use 1 + reviewPhaseConstraint?.value != null ? '1' : undefined // otherwise if we have a review phase constraint use 1 : undefined, 4: undefined, // View Response During Appeals 5: undefined, // Manual Screening @@ -279,7 +278,7 @@ class LegacyMapper { } // prettier-ignore - private mapScorecard(subTrack: string, phase: string): string|undefined { + private mapScorecard(subTrack: string, phase: string): string | undefined { const isNonProd = process.env.ENV != "prod"; // TODO: Update scorecard ids for all subtracks and check for dev environment @@ -288,7 +287,7 @@ class LegacyMapper { // F2F if (subTrack === V4_SUBTRACKS.FIRST_2_FINISH) scorecard = isNonProd ? 30002160 : 30002160; // missing dev scorecard - if (subTrack === V4_SUBTRACKS.DESIGN_FIRST_2_FINISH) scorecard = isNonProd ? 30001610 :30001101; // missing dev scorecard + if (subTrack === V4_SUBTRACKS.DESIGN_FIRST_2_FINISH) scorecard = isNonProd ? 30001610 : 30001101; // missing dev scorecard // QA if (subTrack === V4_SUBTRACKS.BUG_HUNT) { @@ -297,7 +296,7 @@ class LegacyMapper { } // DS - if (subTrack === V4_SUBTRACKS.DEVELOP_MARATHON_MATCH) scorecard = isNonProd ? 30001610 :30002133; // missing dev scorecard + if (subTrack === V4_SUBTRACKS.DEVELOP_MARATHON_MATCH) scorecard = isNonProd ? 30001610 : 30002133; // missing dev scorecard if (subTrack === V4_SUBTRACKS.MARATHON_MATCH) scorecard = isNonProd ? 30001610 : 30002133; // missing dev scorecard // DESIGN