-
Notifications
You must be signed in to change notification settings - Fork 1
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
Redirect to active samf recruitment #1861
base: master
Are you sure you want to change the base?
Conversation
…host:8000/api/active-recruitment/samfundet/
…tment specific page if there is only one recruitment
… if there is one navigate to the one. When there is many it goes to the public page with a list of recruitments. A bit sceptical of this solution.
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.
@action(detail=False, methods=['get'], url_path='samfundet') | ||
def get_active_samf_recruitments(self, request: Request, **kwargs: Any) -> Response: | ||
try: | ||
samfundet_org = Organization.objects.get(name='Samfundet') |
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.
Finn eller flytt name inn i en konstant noe sted
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.
Sånn her lissom? 8ff2c70
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.
^det ble feil,. Dette funker: e81d635
# Get active recruitments for Samfundet, using the overriden get_queryset method | ||
active_samfundet_recruitments = self.get_queryset().filter(organization=samfundet_org) | ||
|
||
if not active_samfundet_recruitments: | ||
return Response({'message': 'No active recruitment for Samfundet'}, status=status.HTTP_404_NOT_FOUND) |
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.
Syntes det virker riktigere å returnere en tom liste her enn en 404 feil?
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.
Dvs bare fjerne dette?
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.
Tror jeg er uenig. Er det ikke bedre at det er tydelig at det ikke finnes opptak, i stede for å returnere en tom liste. Jeg føler det å returnere en tom liste mer sannsynlig gjøre at fremtidige devs kan komme til å tro at det er noe feil i koden hvis det returneres en tom liste sammenlignet med melding som sier at det ikke finnes opptak som etterspørres her.
Nå gjorde jeg forresten en delvis urelatert endring (her fe23411)hvor jeg sjekker om det eksistere ne organisasjon med navn Samfundet med en if-statement istedefor en try/catch. Føler det er litt mer lesbart og gjøre kan "flyte" litt bedre enn exceptions.
Jeg mener i hvertfall man burde sjekke om organisasjonen med navn Samfundet eksistere, slik at får en feil hvis Samf av en eller annen grunn heter noe annet, f.eks. Samf eller Studentersamfundet i Trondhjem.
route={ | ||
activeSamfRecruitments.length === 1 | ||
? // goes to the one samf recruitment if there is only one | ||
reverse({ | ||
pattern: ROUTES.frontend.organization_recruitment, | ||
urlParams: { recruitmentId: activeSamfRecruitments[0].id }, | ||
}) | ||
: // goes to the page with recruitment cards if there is multiple samf recruitments | ||
ROUTES.frontend.recruitment | ||
} |
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.
Dette kan gå i en konstant
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.
done d70b36d
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.
og med en oppfølger her 1ec48cf
try { | ||
const activeSamfRecruitments = await getActiveSamfRecruitments(); |
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.
tanstack?
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.
Det er ikke tsx, altså, kan ikke kjøre en hook her
/> | ||
{showActiveRecruitments && ( |
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.
Nå forsvinner knappen når det ikke er opptak. Det er ikke ønsket, man burde kunne trykke seg inn når som helst for å få info om opptak generelt, og når neste opptak evt. er
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.
Endret her 1c52c77
…wy error handling
What
Add view for fetching samfundet active recruitments. See http://localhost:8000/api/active-recruitment/samfundet/
Adds special loader, checking if there are multiple samf recruitment, if there is one navigate to the one. When there is many it goes to the public page with a list of recruitments.
Why
We don't know if we actually want to promote other recruitments on the website. This is something we need to discuss with opptaksforum, ISFiT and UKA.
closes #1475