Skip to content

Feat/phase logic update #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions src/util/LegacyMapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
}));
}
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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) {
Expand All @@ -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
Expand Down