From 1f04608065fd648539b652d38d397eea6bd4314c Mon Sep 17 00:00:00 2001 From: eisbilir Date: Thu, 23 Mar 2023 02:18:40 +0300 Subject: [PATCH 1/2] fix: legacy phase mapper --- src/util/LegacyMapper.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/util/LegacyMapper.ts b/src/util/LegacyMapper.ts index db1d444..1534a6a 100644 --- a/src/util/LegacyMapper.ts +++ b/src/util/LegacyMapper.ts @@ -184,13 +184,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 + phaseStatusId: phase.isOpen ? 2 : phase.actualEndDate ? 3 : 1, + fixedStartTime: !phase.predecessor ? undefined : DateUtil.formatDateForIfx(phase.scheduledStartDate!), 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, + actualStartTime: !phase.actualStartDate ? undefined : DateUtil.formatDateForIfx(phase.actualStartDate), + actualEndTime: !phase.actualEndDate ? undefined : DateUtil.formatDateForIfx(phase.actualEndDate), + duration: phase.duration * 1000, phaseCriteria: this.mapPhaseCriteria(subTrack, phase), })); } @@ -211,7 +211,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 +279,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 +288,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 +297,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 From 5e10b34ed2f773fee84388fc1379ae745daebcdc Mon Sep 17 00:00:00 2001 From: Emre Date: Thu, 23 Mar 2023 15:11:54 +0300 Subject: [PATCH 2/2] feat: remove timezone conversion --- src/util/LegacyMapper.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/util/LegacyMapper.ts b/src/util/LegacyMapper.ts index 1534a6a..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 @@ -185,11 +184,11 @@ class LegacyMapper { return phases.map((phase: Challenge_Phase, index: number) => ({ phaseTypeId: this.mapPhaseNameToPhaseTypeId(phase.name), phaseStatusId: phase.isOpen ? 2 : phase.actualEndDate ? 3 : 1, - fixedStartTime: !phase.predecessor ? undefined : DateUtil.formatDateForIfx(phase.scheduledStartDate!), - 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), + 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), }));