Skip to content
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

Tweak to logic and more logging #78

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
20 changes: 11 additions & 9 deletions src/domain/Challenge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,17 @@ class ChallengeDomain extends CoreOperations<Challenge, CreateChallengeInput> {
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 && input.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!,
Expand Down Expand Up @@ -487,15 +498,6 @@ class ChallengeDomain extends CoreOperations<Challenge, CreateChallengeInput> {
}

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()
);
}
}
}

Expand Down