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
hansegucker commented 2021-03-21 11:42:33 +01:00 (Migrated from edugit.org)

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.
hansegucker commented 2021-03-21 17:59:34 +01:00 (Migrated from edugit.org)

created merge request !556 to address this issue

created merge request !556 to address this issue
hansegucker commented 2021-03-21 17:59:34 +01:00 (Migrated from edugit.org)

mentioned in merge request !556

mentioned in merge request !556
nik (Migrated from edugit.org) closed this issue 2021-03-21 18:42:33 +01:00
nik commented 2021-04-15 14:52:54 +02:00 (Migrated from edugit.org)

mentioned in commit 9207dbd52e

mentioned in commit 9207dbd52e68a2b4e1e24943dd37bc5e75f619ab
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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.