Skip to content

Contest Tile: Add support for Rolling Triage #76

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

Merged
merged 5 commits into from
Oct 8, 2024
Merged

Conversation

jacobheun
Copy link
Contributor

@jacobheun jacobheun commented Oct 5, 2024

Summary

  • ContestSchedule now includes a cohort array, which is used by the ContestTile
  • Added a new component, ContestCountdown, that wraps the Countdown component and only requires a ContestSchedule and the optional click handler. It will automatically handle the language selection that's usually owned by the parent component and repeated in multiple places.
    • The Countdown component is backwards compatible, so it can still be used as it is today
  • Updated Storybook to show the various states of cohorts to make it easier to see how those transitions will look
  • Fixed an issue with the getDates logic when Date.now equals the start date of an audit. This resulted in undefined times being returned. The newly added tests caught this and validate the fix.

References

Copy link

vercel bot commented Oct 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
components-library ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 8, 2024 7:47am

@c4-bot
Copy link

c4-bot commented Oct 5, 2024

@@ -15,7 +15,13 @@ function getContestStatuses(
contestStatus: Status.UPCOMING,
};
}
if (isBefore(currentTime, botRaceEnd) && isAfter(currentTime, start)) {
if (isAfter(currentTime, end)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this up to the top, it avoids issues in local dev when the botrace time of 1 hour is longer than the contest in tests. It's also a good early exit anyway

contestStatus: Status.ENDED,
};
}
if (isBefore(currentTime, botRaceEnd) && (isAfter(currentTime, start) || isEqual(currentTime, start))) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added isEqual here, it fixes the issue where if currentTime and start happen to be equivalent the undefined status' get returned.

botRaceEnd,
formattedEnd: format(endDate, "d MMM h:mm a"),
formattedStart: format(startDate, "d MMM h:mm a"),
timeZone: timeZone,
formattedBotRaceEnd: format(botRaceEnd, "d MMMM h:mm a"),
formattedBotRaceEnd: format(botRaceEnd, "d MMM h:mm a"),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was formatted differently, which I noticed in the tests. We don't have bot races anymore, but I figured these should match the other date formats.

Rolling triage audits won't resume exactly at the resume time, so this gives some leeway
@jacobheun jacobheun removed the request for review from SamusElderg October 5, 2024 17:35
@jacobheun
Copy link
Contributor Author

There's more reworking that needs to happen here. We need the audit status as we have to take into account whether or not the audit is paused as that can be transitioned manually and cause things like resumption to happen early.

The logic in here will need to get refactored. Ideally we should just be passing Audit partial objects around instead of picking specific fields, because it forces us to modify params all over the place when we just want to add another prop.

Copy link
Collaborator

@SamusElderg SamusElderg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good, love the tests and extra storybook examples! Sorry i sent you on a goose chase there with the recently changed implementation on the main site!

@jacobheun
Copy link
Contributor Author

Content changes are in, going to start the release train.

@jacobheun jacobheun merged commit 3e6f99e into main Oct 8, 2024
3 checks passed
@jacobheun jacobheun deleted the feat/rolling-triage branch October 8, 2024 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants