-
Notifications
You must be signed in to change notification settings - Fork 3
✨Add priorization of årskull to events #107
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
base: master
Are you sure you want to change the base?
✨Add priorization of årskull to events #107
Conversation
solarmarius
commented
Sep 26, 2025
- Add prioritizedRegistrationDate and prioritizedYears fields to EventInput and EventUpdate models
- Implement early registration access for specific årskull years
- Update valid_registration() function to check prioritized access before regular registration
- Add validation to ensure prioritized registration date occurs before regular registration date
- Add prioritizedRegistrationDate and prioritizedYears fields to EventInput and EventUpdate models - Implement early registration access for specific årskull years - Update valid_registration() function to check prioritized access before regular registration - Add validation to ensure prioritized registration date occurs before regular registration 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.
Bra jobba Marius!
Ta en titt på kommentarene mine og gjerne oppdater testene til spesielt create event og update event slik at vi kan verifisere at alt du har laget funker som det skal. Legger deg til organisasjonen, da skal du kunne sjekke build pipelinen selv også.
app/api/members.py
Outdated
| if values[key]: | ||
| updateInfo[key] = values[key] | ||
|
|
||
| # Check if classof is being updated and already has a value |
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.
Kunne du forklart hvorfor du tenker å stoppe brukeren her?
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.
Relatert til prioritering ved årskull - brukere som allerede har satt et årskull skal ikke kunne endre det for å hindre misbruk.
app/utils/event_utils.py
Outdated
| 400, "Prioritized registration date must be before regular registration date") | ||
| except ValueError: | ||
| raise HTTPException( | ||
| 400, "Invalid date format for prioritized registration 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.
Vil ikke vi også komme hit om det var parsingen til regular date som feilet og?
| validate_registartion_opening_time( | ||
| event.date, event.registrationOpeningDate) | ||
|
|
||
| if event.prioritizedRegistrationDate != None: |
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.
Bra at du sjekker at prioritizedRegistrationDate finnes, validerer den mot selve event-datoen, og – hvis ordinær åpning finnes – at prioritert < ordinær. 👍
app/utils/event_utils.py
Outdated
| event.date, event.prioritizedRegistrationDate) | ||
|
|
||
| # Prioritized registration date must be before regular registration date | ||
| if event.registrationOpeningDate != None: |
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.
Fin ungåelse av unødvendig parsing.
|
|
||
|
|
||
| def valid_registration(opening_date): | ||
| def valid_registration(opening_date, member=None, event=None): |
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.
Prioritert sjekk kommer først og “kortslutter” til True når vinduet er åpent – god rekkefølge og lett å lese. Bra
- Simplify date comparison in event_utils by using direct datetime comparison instead of redundant parsing - Remove unnecessary nested conditionals when validating prioritized registration dates - Clarify classof immutability comment to explain business logic preventing privilege manipulation
|
Ser at parsing-logikken for validate_event_dates var overflødig, så har gjort den enklere. Samt spesifisert kommentar for classof under update_member. |