get_or_create for lesson documentations and personal notes doesn't work correctly because of missing unique index #151

Closed
opened 2021-03-21 11:42:33 +01:00 by hansegucker · 3 comments
Owner

Opening a single lesson (or event or extra lesson) often causes an Internal Server Error. Internally, using get_or_create sometimes raise a MultipleObjectsReturned exception. The reasons for this behavior are described here:

  1. https://stackoverflow.com/a/29521117
  2. https://adriennedomingus.com/blog/the-perils-of-getorcreate-race-conditions

A working solution is adding an unique index for the fields lesson_period, week, year, event and extra_lesson. This combination will always be unique.

Opening a single lesson (or event or extra lesson) often causes an Internal Server Error. Internally, using get_or_create sometimes raise a `MultipleObjectsReturned` exception. The reasons for this behavior are described here: 1. https://stackoverflow.com/a/29521117 2. https://adriennedomingus.com/blog/the-perils-of-getorcreate-race-conditions A working solution is adding an unique index for the fields `lesson_period`, `week`, `year`, `event` and `extra_lesson`. This combination will always be unique.
Author
Owner

created merge request !556 to address this issue

created merge request !556 to address this issue
Author
Owner

mentioned in merge request !556

mentioned in merge request !556
nik closed this issue 2021-03-21 18:42:33 +01:00
Owner

mentioned in commit 9207dbd52e

mentioned in commit 9207dbd52e68a2b4e1e24943dd37bc5e75f619ab
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
aleksis/AlekSIS-App-Alsijil#151
No description provided.