Investigate offering selection when submitting

Bug #610737 reported by Matt Giuca
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
IVLE
Triaged
High
Unassigned

Bug Description

In ivle.webapp.submit.UserSubmitView, the get_offering method is a bit confusing. Here it is:

        return Store.of(self.context).find(Offering,
            Offering.id == Enrolment.offering_id,
            Enrolment.user_id == self.context.id,
            Offering.semester_id == Semester.id,
            Semester.state == u'current',
            Offering.subject_id == Subject.id,
            Subject.short_name == self.path.split('/')[1],
            ).one()

That means, find the offering as follows:
- Find the subject S with the short name matching the second-level directory in the user's repo (FAIL if the user is not in a directory named after a known subject),
- Find all offerings O for subject S,
- Drop any offering which is not a) in a "current" semester, AND b) the user is not enrolled in,
- Fail if the offering set O is empty. Otherwise, take one offering, and return it.

There are a few problems with this:
- Many failure conditions (not in a subject directory, user not enrolled, or user enrolled in an offering which is not current). With the fix for bug #526853, we handle this by giving a vague error message. We should detect exactly why it failed.
- Possibility of multiple offerings matching the query. If there are two offerings of the same subject which are both in a "current" semester for some reason, then it is undefined which offering is being submitted to. I don't know what .one() does if there are multiple results (error, or just pick one?). We should figure out a strategy for handling this case.

Tags: submit
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.