-
Notifications
You must be signed in to change notification settings - Fork 0
Enhanced Topgear hourly report by adding registration and submission … #39
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,6 +89,24 @@ submitter_roles AS ( | |
| SELECT id | ||
| FROM resources."ResourceRole" | ||
| WHERE COALESCE("nameLower", LOWER(name)) = 'submitter' | ||
| ), | ||
| registration_end AS ( | ||
| SELECT | ||
| cp."challengeId" AS challenge_id, | ||
| MAX(COALESCE(cp."actualEndDate", cp."scheduledEndDate")) AS registration_end_date | ||
| FROM challenges."ChallengePhase" cp | ||
| JOIN challenges."Phase" p ON p.id = cp."phaseId" | ||
| WHERE p.name = 'Registration' | ||
| GROUP BY cp."challengeId" | ||
| ), | ||
| submission_end AS ( | ||
| SELECT | ||
| cp."challengeId" AS challenge_id, | ||
| MAX(COALESCE(cp."actualEndDate", cp."scheduledEndDate")) AS submission_end_date | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| FROM challenges."ChallengePhase" cp | ||
| JOIN challenges."Phase" p ON p.id = cp."phaseId" | ||
| WHERE p.name IN ('Topcoder Submission', 'Submission') | ||
| GROUP BY cp."challengeId" | ||
| ) | ||
| SELECT | ||
| bc."updatedAt" AS modify_date, | ||
|
|
@@ -99,8 +117,8 @@ SELECT | |
| bc.name AS challenge_name, | ||
| bc.status AS challenge_status, | ||
| ct.name AS challenge_type, | ||
| bc."registrationEndDate" AS registration_end_date, | ||
| bc."submissionEndDate" AS submission_end_date, | ||
| re.registration_end_date AS registration_end_date, | ||
| se.submission_end_date AS submission_end_date, | ||
| pd.latest_actual_end_date AS completed_date, | ||
| mt.onsite_efforts AS onsite_efforts, | ||
| mt.offsite_efforts AS offsite_efforts, | ||
|
|
@@ -194,6 +212,10 @@ LEFT JOIN tag_list tl | |
| ON tl.challenge_id = bc.id | ||
| LEFT JOIN group_list gl | ||
| ON gl.challenge_id = bc.id | ||
| LEFT JOIN registration_end re | ||
| ON re.challenge_id = bc.id | ||
| LEFT JOIN submission_end se | ||
| ON se.challenge_id = bc.id | ||
| LEFT JOIN LATERAL ( | ||
| SELECT | ||
| MAX(cp."actualEndDate") AS latest_actual_end_date | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[⚠️
correctness]Using
MAX(COALESCE(cp."actualEndDate", cp."scheduledEndDate"))to determine theregistration_end_dateassumes that the maximum of these dates is always the correct end date. Consider whether this logic accurately reflects the business rules, as it may not account for scenarios where the scheduled end date should take precedence over the actual end date.