Skip to content

Commit fead91f

Browse files
authored
Feat/phase logic update (#17)
* fix: legacy phase mapper * feat: remove timezone conversion
1 parent bfa9d4e commit fead91f

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

src/util/LegacyMapper.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { PrizeSetTypes } from "../common/Constants";
33
import { V4_SUBTRACKS, V5_TO_V4 } from "../common/ConversionMap";
44
import { Challenge_Phase } from "../models/domain-layer/challenge/challenge";
55
import { legacyChallengeStatusesMap } from "./constants";
6-
import DateUtil from "./DateUtil";
76

87
class LegacyMapper {
98
// To be used on challenge:update calls that change state from New -> Draft
@@ -184,13 +183,13 @@ class LegacyMapper {
184183
public mapPhases(subTrack: string, phases: Challenge_Phase[]) {
185184
return phases.map((phase: Challenge_Phase, index: number) => ({
186185
phaseTypeId: this.mapPhaseNameToPhaseTypeId(phase.name),
187-
phaseStatusId: phase.isOpen ? 2 : 1, // Set Open if phase is open, otherwise mark it Scheduled [1: Scheduled, 2: Open, 3: Closed]
188-
fixedStartTime: phase.name === "Registration" ? DateUtil.formatDateForIfx(phase.scheduledStartDate!) : undefined, // Registration Phase needs a fixedStartTime
189-
scheduledStartTime: DateUtil.formatDateForIfx(phase.scheduledStartDate!),
190-
scheduledEndTime: DateUtil.formatDateForIfx(phase.scheduledEndDate!),
191-
actualStartTime: !phase.actualStartDate ? undefined: DateUtil.formatDateForIfx(phase.actualStartDate) ,
192-
actualEndTime: !phase.actualEndDate ? undefined: DateUtil.formatDateForIfx(phase.actualEndDate) ,
193-
duration: phase.duration,
186+
phaseStatusId: phase.isOpen ? 2 : phase.actualEndDate ? 3 : 1,
187+
fixedStartTime: !phase.predecessor ? undefined : phase.scheduledStartDate!,
188+
scheduledStartTime: phase.scheduledStartDate!,
189+
scheduledEndTime: phase.scheduledEndDate!,
190+
actualStartTime: !phase.actualStartDate ? undefined : phase.actualStartDate,
191+
actualEndTime: !phase.actualEndDate ? undefined : phase.actualEndDate,
192+
duration: phase.duration * 1000,
194193
phaseCriteria: this.mapPhaseCriteria(subTrack, phase),
195194
}));
196195
}
@@ -211,7 +210,7 @@ class LegacyMapper {
211210
1: this.mapScorecard(subTrack, phase.name), // Scorecard ID
212211
2: phase.name === "Registration" ? '1' : undefined, // Registration Number
213212
3: phase.name === "Submission" ? submissionPhaseConstraint?.value.toString() ?? // if we have a submission phase constraint use it
214-
reviewPhaseConstraint?.value != null ? '1' : undefined // otherwise if we have a review phase constraint use 1
213+
reviewPhaseConstraint?.value != null ? '1' : undefined // otherwise if we have a review phase constraint use 1
215214
: undefined,
216215
4: undefined, // View Response During Appeals
217216
5: undefined, // Manual Screening
@@ -279,7 +278,7 @@ class LegacyMapper {
279278
}
280279

281280
// prettier-ignore
282-
private mapScorecard(subTrack: string, phase: string): string|undefined {
281+
private mapScorecard(subTrack: string, phase: string): string | undefined {
283282
const isNonProd = process.env.ENV != "prod";
284283

285284
// TODO: Update scorecard ids for all subtracks and check for dev environment
@@ -288,7 +287,7 @@ class LegacyMapper {
288287

289288
// F2F
290289
if (subTrack === V4_SUBTRACKS.FIRST_2_FINISH) scorecard = isNonProd ? 30002160 : 30002160; // missing dev scorecard
291-
if (subTrack === V4_SUBTRACKS.DESIGN_FIRST_2_FINISH) scorecard = isNonProd ? 30001610 :30001101; // missing dev scorecard
290+
if (subTrack === V4_SUBTRACKS.DESIGN_FIRST_2_FINISH) scorecard = isNonProd ? 30001610 : 30001101; // missing dev scorecard
292291

293292
// QA
294293
if (subTrack === V4_SUBTRACKS.BUG_HUNT) {
@@ -297,7 +296,7 @@ class LegacyMapper {
297296
}
298297

299298
// DS
300-
if (subTrack === V4_SUBTRACKS.DEVELOP_MARATHON_MATCH) scorecard = isNonProd ? 30001610 :30002133; // missing dev scorecard
299+
if (subTrack === V4_SUBTRACKS.DEVELOP_MARATHON_MATCH) scorecard = isNonProd ? 30001610 : 30002133; // missing dev scorecard
301300
if (subTrack === V4_SUBTRACKS.MARATHON_MATCH) scorecard = isNonProd ? 30001610 : 30002133; // missing dev scorecard
302301

303302
// DESIGN

0 commit comments

Comments
 (0)