From f5db91ebeef7a6994cdc812c174beece94e375dd Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Tue, 11 Jun 2024 10:03:42 +1000 Subject: [PATCH 1/6] Tweak to logic and more logging --- src/domain/Challenge.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/domain/Challenge.ts b/src/domain/Challenge.ts index 1cd3f99..00641e2 100644 --- a/src/domain/Challenge.ts +++ b/src/domain/Challenge.ts @@ -488,7 +488,7 @@ class ChallengeDomain extends CoreOperations { generatePayments = input.paymentUpdate != null && input.paymentUpdate.payments.length > 0; - if(!challenge?.legacy?.pureV5Task){ + if(!(challenge?.legacy?.pureV5Task)){ // Load the submission and review data from Informix into ES for caching purposes. This just makes a call to the submission // API with a "loadLegacy=true" flag, which will force a load from Informix --> ES. await loadInformixSubmissions( @@ -496,6 +496,9 @@ class ChallengeDomain extends CoreOperations { await m2mToken.getM2MToken() ); } + else{ + console.log(`Not loading reviews because challenge ${challenge.id} is a pure v5 task`) + } } } From 3006cceb9ad287aa8585ae27943bcca881026d13 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Thu, 20 Jun 2024 07:00:16 +1000 Subject: [PATCH 2/6] Tweaked where we do the Informix loading --- src/domain/Challenge.ts | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/domain/Challenge.ts b/src/domain/Challenge.ts index 00641e2..bf4c6b8 100644 --- a/src/domain/Challenge.ts +++ b/src/domain/Challenge.ts @@ -420,6 +420,21 @@ class ChallengeDomain extends CoreOperations { } } } + if ( + input.status === ChallengeStatuses.Completed && + challenge.status !== ChallengeStatuses.Completed && + !(challenge?.legacy?.pureV5Task) + ) { + // Load the submission and review data from Informix into ES for caching purposes. This just makes a call to the submission + // API with a "loadLegacy=true" flag, which will force a load from Informix --> ES. + await loadInformixSubmissions( + challenge.id, + await m2mToken.getM2MToken()) + + } + else{ + console.log(`Not loading reviews because challenge ${challenge.id} is a pure v5 task`) + } // End Anti-Corruption Layer } else { // This is a Pure V5 Challenge @@ -487,18 +502,6 @@ class ChallengeDomain extends CoreOperations { } generatePayments = input.paymentUpdate != null && input.paymentUpdate.payments.length > 0; - - if(!(challenge?.legacy?.pureV5Task)){ - // Load the submission and review data from Informix into ES for caching purposes. This just makes a call to the submission - // API with a "loadLegacy=true" flag, which will force a load from Informix --> ES. - await loadInformixSubmissions( - challenge.id, - await m2mToken.getM2MToken() - ); - } - else{ - console.log(`Not loading reviews because challenge ${challenge.id} is a pure v5 task`) - } } } From 3c6db13774c929540257a109ec9ae6bc7d5fcabf Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Thu, 20 Jun 2024 07:05:30 +1000 Subject: [PATCH 3/6] Tweaked comment layout --- src/domain/Challenge.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/domain/Challenge.ts b/src/domain/Challenge.ts index bf4c6b8..cd52495 100644 --- a/src/domain/Challenge.ts +++ b/src/domain/Challenge.ts @@ -420,13 +420,13 @@ class ChallengeDomain extends CoreOperations { } } } + // Load the submission and review data from Informix into ES for caching purposes, at the end of a challenge. + // This just makes a call to the submission API with a "loadLegacy=true" flag, which will force a load from Informix --> ES. if ( input.status === ChallengeStatuses.Completed && challenge.status !== ChallengeStatuses.Completed && !(challenge?.legacy?.pureV5Task) ) { - // Load the submission and review data from Informix into ES for caching purposes. This just makes a call to the submission - // API with a "loadLegacy=true" flag, which will force a load from Informix --> ES. await loadInformixSubmissions( challenge.id, await m2mToken.getM2MToken()) From 08ecaf50f295367a6bd681b9d48ad85c723c002a Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Tue, 9 Jul 2024 16:38:20 +1000 Subject: [PATCH 4/6] Better message --- src/domain/Challenge.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/domain/Challenge.ts b/src/domain/Challenge.ts index cd52495..4794a79 100644 --- a/src/domain/Challenge.ts +++ b/src/domain/Challenge.ts @@ -433,7 +433,7 @@ class ChallengeDomain extends CoreOperations { } else{ - console.log(`Not loading reviews because challenge ${challenge.id} is a pure v5 task`) + console.log(`Not loading reviews because challenge ${challenge.id} is a pure v5 task or not complete yet`) } // End Anti-Corruption Layer } else { From c6cb5801170b6f2603377ba53ccaa50afb9180d8 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Tue, 9 Jul 2024 16:48:22 +1000 Subject: [PATCH 5/6] Better clarity and tracing --- src/domain/Challenge.ts | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/domain/Challenge.ts b/src/domain/Challenge.ts index 4794a79..5ca3030 100644 --- a/src/domain/Challenge.ts +++ b/src/domain/Challenge.ts @@ -391,6 +391,17 @@ class ChallengeDomain extends CoreOperations { input.phaseUpdate = { phases }; legacyId = legacyChallengeId; } else if (challenge.status !== ChallengeStatuses.New) { + // Load the submission and review data from Informix into ES for caching purposes, at the end of a challenge. + // This just makes a call to the submission API with a "loadLegacy=true" flag, which will force a load from Informix --> ES. + if (challenge.status !== ChallengeStatuses.Completed) { + await loadInformixSubmissions( + challenge.id, + await m2mToken.getM2MToken()) + } + else{ + console.log(`Not loading reviews yet because challenge ${challenge.id} is not complete`) + } + // prettier-ignore const updateChallengeInput = await legacyMapper.mapChallengeUpdateInput( challenge.legacyId!, @@ -420,21 +431,6 @@ class ChallengeDomain extends CoreOperations { } } } - // Load the submission and review data from Informix into ES for caching purposes, at the end of a challenge. - // This just makes a call to the submission API with a "loadLegacy=true" flag, which will force a load from Informix --> ES. - if ( - input.status === ChallengeStatuses.Completed && - challenge.status !== ChallengeStatuses.Completed && - !(challenge?.legacy?.pureV5Task) - ) { - await loadInformixSubmissions( - challenge.id, - await m2mToken.getM2MToken()) - - } - else{ - console.log(`Not loading reviews because challenge ${challenge.id} is a pure v5 task or not complete yet`) - } // End Anti-Corruption Layer } else { // This is a Pure V5 Challenge From 322c6b2db14fc0531fe9fbda5a48b793911c7742 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Tue, 6 Aug 2024 16:38:10 +1000 Subject: [PATCH 6/6] Better status check --- src/domain/Challenge.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/domain/Challenge.ts b/src/domain/Challenge.ts index 5ca3030..efadab7 100644 --- a/src/domain/Challenge.ts +++ b/src/domain/Challenge.ts @@ -393,7 +393,7 @@ class ChallengeDomain extends CoreOperations { } else if (challenge.status !== ChallengeStatuses.New) { // Load the submission and review data from Informix into ES for caching purposes, at the end of a challenge. // This just makes a call to the submission API with a "loadLegacy=true" flag, which will force a load from Informix --> ES. - if (challenge.status !== ChallengeStatuses.Completed) { + if (challenge.status !== ChallengeStatuses.Completed && input.status === ChallengeStatuses.Completed) { await loadInformixSubmissions( challenge.id, await m2mToken.getM2MToken())