Skip to content
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

Feature/193 student acceptance #195

Merged
merged 3 commits into from
Apr 27, 2024
Merged

Conversation

auroranavas
Copy link
Contributor

This PR aims to change the status of a Student when a year since status = ACEPTADO has passed.
First, I tried to implement it so it was done automatically, ie asynchronously. However, since Django is a synchronous framework it, would have to be done with third-party libraries. By researching this, I saw that this approach was more complicated than it seemed and didn't seem worth it.

So, what I did was introduce a field in Student called acceptance_date. I have overridden the retrieve method do that every time a GET is made, it checks if it has been more than a year since acceptance_date. If more than a year has passed, the status changes to RECHAZADO.

Note for Frontend developers: When a Student is created, the acceptance_date should be left null (don't send anything to backend). When the admin accepts the Student, then you should send the acceptance_date as Date.today.

@auroranavas auroranavas self-assigned this Apr 24, 2024
@auroranavas auroranavas linked an issue Apr 24, 2024 that may be closed by this pull request
Copy link
Contributor

@JuanluRM JuanluRM left a comment

Choose a reason for hiding this comment

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

The retrieve method seem to work as intended but the issue is that if we don't call students thought the view, it doesn't get updated. This as far as I know only happens through the export function, which means if an admin wants to export students it won't update the status so for example it will appear "ACEPTADO" when should be "CADUCADO" because a year has passed. I ask you to fix that so it checks before exports as well.

@auroranavas
Copy link
Contributor Author

auroranavas commented Apr 26, 2024

I think that what you requested should be covered now. Thank you for your feedback 😊.
By the way, most of the lines that appear edited by me is formatting made by Black in my IDE.

Copy link
Contributor

@JuanluRM JuanluRM left a comment

Choose a reason for hiding this comment

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

Everything seems to be working well now, remember to forward the note for front end so they update the acceptance_date every time a student is accepted. Well done.

@auroranavas auroranavas merged commit cc14c4d into develop Apr 27, 2024
6 checks passed
@auroranavas auroranavas deleted the feature/193-student-acceptance branch April 27, 2024 10:54
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.

Student Acceptance
2 participants