bmun / huxley

Conference management system for Berkeley Model United Nations.
http://www.bmun.org
BSD 3-Clause "New" or "Revised" License
37 stars 42 forks source link

PositionPaper objects with no Assignment #805

Open srisainachuri opened 2 years ago

srisainachuri commented 2 years ago

There is currently a one-to-one relationship between Assignment and PositionPaper objects such that when Assignments are deleted, the corresponding PositionPaper objects get deleted. In manual testing there does not seem to be an issue with this, but during live registration, the database occasionally becomes populated with PositionPaper objects with no corresponding Assignment object, causing the server to error when viewing Assignments in Admin view. Further investigation will be needed to figure out the root cause of this bug.

erwang01 commented 2 years ago

Seems to be SET_NULL on delete rather than CASCADE: https://github.com/bmun/huxley/blob/fcfdf2e40653eb5a0280eb8714b93f10d9b5b43c/huxley/core/models.py#L500-L501

PositionPaper objects are left in the table with the Assignment field as NULL. Most likely this is resulting in an error when calling PositionPaper.__str__