Skip to content

Commit f601c8c

Browse files
committed
Merge branch 'main' into feature/dev
2 parents c71e661 + f4ef49e commit f601c8c

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
- image: cimg/aws:2023.01
77
environment:
88
CODEARTIFACT_ENV: PROD
9-
ECR_ENV: DEV
9+
ECR_ENV: QA
1010
SERVICE_NAME: "domain-challenge"
1111
OUT_DIR: "buildscripts"
1212
steps:

src/domain/Challenge.ts

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -340,24 +340,22 @@ class ChallengeDomain extends CoreOperations<Challenge, CreateChallengeInput> {
340340
await legacyPhaseDomain.updateProjectPhase({
341341
projectPhaseId: phase.projectPhaseId,
342342
phaseStatusId: newStatus,
343-
fixedStartTime: moment(phase.fixedStartTime).format(
344-
"yyyy-MM-DD HH:mm:ss"
345-
)
346-
? moment(v5Equivalent.scheduledStartDate).format(
347-
"yyyy-MM-DD HH:mm:ss"
348-
)
349-
: undefined,
343+
...(phaseOrder === 0 ? {
344+
fixedStartTime: moment(phase.fixedStartTime).format(
345+
"yyyy-MM-DD HH:mm:ss"
346+
)
347+
? moment(v5Equivalent.scheduledStartDate).format(
348+
"yyyy-MM-DD HH:mm:ss"
349+
)
350+
: undefined,
351+
} : {}),
350352
scheduledStartTime: moment(
351353
v5Equivalent.scheduledStartDate
352354
).format("yyyy-MM-DD HH:mm:ss"),
353355
scheduledEndTime: moment(v5Equivalent.scheduledEndDate).format(
354356
"yyyy-MM-DD HH:mm:ss"
355357
),
356358
duration: v5Equivalent.duration * 1000,
357-
...(isBeingActivated &&
358-
newStatus == constants.PhaseStatusTypes.Open
359-
? { actualStartTime: moment().format("yyyy-MM-DD HH:mm:ss") }
360-
: {}),
361359
});
362360
} else {
363361
console.log(`number of ${phaseName} does not match`);
@@ -964,7 +962,8 @@ class ChallengeDomain extends CoreOperations<Challenge, CreateChallengeInput> {
964962
const createdByUserId = 22838965; // TODO: Extract from interceptors
965963
const updatedByUserId = 22838965; // TODO: Extract from interceptors
966964

967-
if (!input?.legacyId) {
965+
if (!input?.legacyId && input?.status && input?.status !== ChallengeStatuses.New) {
966+
console.log(`Legacy ID does not exist. Creating challenge in legacy...`);
968967
const { track, subTrack, isTask, technologies } =
969968
legacyMapper.mapTrackAndType(
970969
input.trackId as string,
@@ -1003,6 +1002,7 @@ class ChallengeDomain extends CoreOperations<Challenge, CreateChallengeInput> {
10031002
input.legacyId = legacyChallengeId as number;
10041003
}
10051004

1005+
console.log(`Updating challenge in legacy...`);
10061006
if (input?.legacyId) {
10071007
const legacyId = input.legacyId;
10081008
const legacyChallenge = await legacyChallengeDomain.getLegacyChallenge({
@@ -1251,6 +1251,7 @@ class ChallengeDomain extends CoreOperations<Challenge, CreateChallengeInput> {
12511251
}
12521252
}
12531253
}
1254+
console.log("Challenge updated successfully in legacy");
12541255

12551256
// toEntity parses the below properties thus we should now stringify them again
12561257
// for (const key of ["phases",
@@ -1261,16 +1262,14 @@ class ChallengeDomain extends CoreOperations<Challenge, CreateChallengeInput> {
12611262
// "prizeSets"]) {
12621263
// _.set(input, key, JSON.stringify(_.get(input, key)))
12631264
// }
1264-
// console.log('------ before save --------');
1265+
console.log('------ before save --------');
12651266

12661267
// console.log(input);
12671268
console.log(_.omit(input, ["id"]));
12681269

12691270
const challengeList = await super.update(scanCriteria, {
1270-
..._.omit(input, ["id"]),
1271-
...(input.prizeSets
1272-
? { prizeSets: input.prizeSets.map((ps) => JSON.stringify(ps)) }
1273-
: {}),
1271+
..._.omit(input, ["id", ...(!input.legacyId ? ["legacyId"] : [])]),
1272+
// prizeSets: input.prizeSets.map((ps) => JSON.stringify(ps)),
12741273
});
12751274

12761275
console.log("------ after save --------");

src/schema/Challenge.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const ChallengeSchema = {
3333
},
3434
{
3535
name: "billing",
36-
type: DataType.DATA_TYPE_STRING,
36+
type: DataType.DATA_TYPE_MAP,
3737
},
3838
{
3939
name: "description",
@@ -53,7 +53,7 @@ export const ChallengeSchema = {
5353
},
5454
{
5555
name: "task",
56-
type: DataType.DATA_TYPE_STRING,
56+
type: DataType.DATA_TYPE_MAP,
5757
},
5858
{
5959
name: "timelineTemplateId",
@@ -69,7 +69,7 @@ export const ChallengeSchema = {
6969
},
7070
{
7171
name: "prizeSets",
72-
type: DataType.DATA_TYPE_STRING_SET,
72+
type: DataType.DATA_TYPE_LIST,
7373
},
7474
{
7575
name: "tags",
@@ -125,7 +125,7 @@ export const ChallengeSchema = {
125125
},
126126
{
127127
name: "overview",
128-
type: DataType.DATA_TYPE_STRING,
128+
type: DataType.DATA_TYPE_MAP,
129129
},
130130
],
131131
indices: {

src/util/LegacyMapper.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ class LegacyMapper {
3636
: undefined, // Registration Phase needs a fixedStartTime
3737
scheduledStartTime: DateUtil.formatDateForIfx(phase.scheduledStartDate),
3838
scheduledEndTime: DateUtil.formatDateForIfx(phase.scheduledEndDate),
39-
actualStartTime: DateUtil.formatDateForIfx(phase.actualStartDate),
40-
actualEndTime: DateUtil.formatDateForIfx(phase.actualEndDate),
39+
// TODO: Confirm this is correct
40+
// actualStartTime: DateUtil.formatDateForIfx(phase.actualStartDate),
41+
// actualEndTime: DateUtil.formatDateForIfx(phase.actualEndDate),
4142
duration: phase.duration,
4243
phaseCriteria: this.mapPhaseCriteria(phase),
4344
})),

0 commit comments

Comments
 (0)