-
Notifications
You must be signed in to change notification settings - Fork 0
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
Hotfix/url bugs and rush threshold #164
Conversation
utils/getRushThreshold.ts
Outdated
const attendedRemaining = remainingEvents.filter((event) => events[event]).length; | ||
|
||
// Check if the rush threshold is met: at least 1 mandatory event and 2 other events | ||
return attendedMandatory && attendedRemaining >= 2; |
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.
Can we make the count 2
is a constant? Additionally, you use that logic on both functions so maybe you can abstract this by creating a helper function like isRushThresholdMet(...)
- verbosity in this case would help understand the functionality better.
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.
Completely agree on both. I'll update 2
to be a constant, but Imma come back to the abstraction on a separate PR bc I'm a bit swamped rn lol (and I wanna fix the analytics processing in the backend anyways)
utils/getRushThreshold.ts
Outdated
|
||
export const getRushThreshold = (events: { [key: string]: boolean }) => { | ||
// Check if at least one mandatory event was attended | ||
const attendedMandatory = mandatoryEvents.some((event) => events[event]); |
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.
nit - hasAttendedMandatoryEvent
would be a better name
const attendedMandatory = mandatoryEvents.some((event) => events[event]); | ||
|
||
// Count how many remaining events were attended | ||
const attendedRemaining = remainingEvents.filter((event) => events[event]).length; |
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.
nit - numAttendedRemainingEvents
? or maybe a better name would be better.
What does this PR do?
Type of change
Tests Performed
Screenshots
Additional Comments