Skip to content

Commit 81144b6

Browse files
authored
Fix/sc (#19)
* fix: scorecard mapping * fix: scorecard mapper
1 parent c24c1f7 commit 81144b6

File tree

2 files changed

+69
-27
lines changed

2 files changed

+69
-27
lines changed

src/common/Constants.ts

+21
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,24 @@ export const ChallengeStatuses = {
4444
New: "New",
4545
Active: "Active",
4646
};
47+
48+
export const PhaseTypeIds = {
49+
Registration: 1,
50+
Submission: 2,
51+
Screening: 3,
52+
Review: 4,
53+
Appeals: 5,
54+
AppealsResponse: 6,
55+
Aggregation: 7,
56+
AggregationReview: 8,
57+
FinalFix: 9,
58+
FinalReview: 10,
59+
Approval: 11,
60+
PostMortem: 12,
61+
SpecificationSubmission: 13,
62+
SpecificationReview: 14,
63+
CheckpointSubmission: 15,
64+
CheckpointScreening: 16,
65+
CheckpointReview: 17,
66+
IterativeReview: 18,
67+
};

src/util/LegacyMapper.ts

+48-27
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import _ from "lodash";
2-
import { PrizeSetTypes } from "../common/Constants";
2+
import { PhaseTypeIds, 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";
@@ -207,7 +207,7 @@ class LegacyMapper {
207207

208208

209209
return {
210-
1: this.mapScorecard(subTrack, phase.name), // Scorecard ID
210+
1: this.mapScorecard(subTrack, this.mapPhaseNameToPhaseTypeId(phase.name)), // Scorecard ID
211211
2: phase.name === "Registration" ? '1' : undefined, // Registration Number
212212
3: phase.name === "Submission" ? submissionPhaseConstraint?.value.toString() ?? // if we have a submission phase constraint use it
213213
reviewPhaseConstraint?.value != null ? '1' : undefined // otherwise if we have a review phase constraint use 1
@@ -278,39 +278,60 @@ class LegacyMapper {
278278
}
279279

280280
// prettier-ignore
281-
private mapScorecard(subTrack: string, phase: string): string | undefined {
281+
private mapScorecard(subTrack: string, phaseTypeId: number | undefined): string | undefined {
282282
const isNonProd = process.env.ENV != "prod";
283283

284284
// TODO: Update scorecard ids for all subtracks and check for dev environment
285285

286286
let scorecard = undefined;
287287

288-
// F2F
289-
if (subTrack === V4_SUBTRACKS.FIRST_2_FINISH) scorecard = isNonProd ? 30002160 : 30002160; // missing dev scorecard
290-
if (subTrack === V4_SUBTRACKS.DESIGN_FIRST_2_FINISH) scorecard = isNonProd ? 30001610 : 30001101; // missing dev scorecard
291-
292-
// QA
293-
if (subTrack === V4_SUBTRACKS.BUG_HUNT) {
294-
if (phase === "Review") scorecard = isNonProd ? 30001610 : 30001220; // missing dev scorecard
295-
if (phase === "Specification Review") scorecard = isNonProd ? 30001610 : 30001120; // missing dev scorecard
288+
if (
289+
subTrack === V4_SUBTRACKS.FIRST_2_FINISH &&
290+
phaseTypeId === PhaseTypeIds.IterativeReview
291+
) {
292+
scorecard = isNonProd ? 30002160 : 30002160;
293+
} else if (
294+
subTrack === V4_SUBTRACKS.DESIGN_FIRST_2_FINISH &&
295+
phaseTypeId === PhaseTypeIds.Review
296+
) {
297+
scorecard = isNonProd ? 30001610 : 30001101;
298+
} else if (subTrack === V4_SUBTRACKS.BUG_HUNT) {
299+
if (phaseTypeId === PhaseTypeIds.Review) {
300+
scorecard = isNonProd ? 30001610 : 30001220;
301+
} else if (phaseTypeId === PhaseTypeIds.SpecificationReview) {
302+
scorecard = isNonProd ? 30001610 : 30001120;
303+
}
304+
} else if (
305+
subTrack === V4_SUBTRACKS.DEVELOP_MARATHON_MATCH &&
306+
phaseTypeId === PhaseTypeIds.Review
307+
) {
308+
scorecard = isNonProd ? 30001610 : 30002133;
309+
} else if (
310+
subTrack === V4_SUBTRACKS.MARATHON_MATCH &&
311+
phaseTypeId === PhaseTypeIds.Review
312+
) {
313+
scorecard = isNonProd ? 30001610 : 30002133;
314+
} else if (subTrack === V4_SUBTRACKS.WEB_DESIGNS) {
315+
if (phaseTypeId === PhaseTypeIds.SpecificationReview) {
316+
scorecard = isNonProd ? 30001610 : 30001040;
317+
} else if (phaseTypeId === PhaseTypeIds.CheckpointScreening) {
318+
scorecard = isNonProd ? 30001610 : 30001364;
319+
} else if (phaseTypeId === PhaseTypeIds.CheckpointReview) {
320+
scorecard = isNonProd ? 30001610 : 30001004;
321+
} else if (phaseTypeId === PhaseTypeIds.Screening) {
322+
scorecard = isNonProd ? 30001610 : 30001363;
323+
} else if (phaseTypeId === PhaseTypeIds.Review) {
324+
scorecard = isNonProd ? 30001610 : 30001031;
325+
} else if (phaseTypeId === PhaseTypeIds.Approval) {
326+
scorecard = isNonProd ? 30001610 : 30000720;
327+
}
328+
} else if (
329+
subTrack === V4_SUBTRACKS.CODE &&
330+
phaseTypeId === PhaseTypeIds.Review
331+
) {
332+
scorecard = isNonProd ? 30002133 : 30002133;
296333
}
297334

298-
// DS
299-
if (subTrack === V4_SUBTRACKS.DEVELOP_MARATHON_MATCH) scorecard = isNonProd ? 30001610 : 30002133; // missing dev scorecard
300-
if (subTrack === V4_SUBTRACKS.MARATHON_MATCH) scorecard = isNonProd ? 30001610 : 30002133; // missing dev scorecard
301-
302-
// DESIGN
303-
if (subTrack === V4_SUBTRACKS.WEB_DESIGNS) {
304-
if (phase === "Specification Review") scorecard = isNonProd ? 30001610 : 30001040; // missing dev scorecard
305-
if (phase === "Checkpoint Screening") scorecard = isNonProd ? 30001610 : 30001364; // missing dev scorecard
306-
if (phase === "Checkpoint Review") scorecard = isNonProd ? 30001610 : 30001004; // missing dev scorecard
307-
if (phase === "Screening") scorecard = isNonProd ? 30001610 : 30001363; // missing dev scorecard
308-
if (phase === "Review") scorecard = isNonProd ? 30001610 : 30001031; // missing dev scorecard
309-
if (phase === "Approval") scorecard = isNonProd ? 30001610 : 30000720; // missing dev scorecard
310-
}
311-
312-
if (subTrack === V4_SUBTRACKS.CODE) scorecard = isNonProd ? 30002133 : 30002133; // missing dev scorecard
313-
314335
return scorecard ? scorecard.toString() : undefined;
315336
}
316337
}

0 commit comments

Comments
 (0)