numbas / numbas-lti-provider

An LTI tool provider to run Numbas exams
https://docs.numbas.org.uk/lti/en/latest/
Other
11 stars 12 forks source link

Timed access changes don't work #333

Closed Lycanic closed 2 months ago

Lycanic commented 2 months ago

Adding an access change for extended time, whether through an altered start/end date or extending the deadline has no impact on the time the student can access the exam - it remains in line with the base exam timings.

christianp commented 2 months ago

Oh dear. The problem is that if you pick a user to apply the access change to from the list returned by the LTI 1.3 names service, the sub field from the platform is saved as the username in a UsernameAccessChange record.

But when finding access changes applying to a user, we check the username field on the User object, which is a UUID. The LTI_13_UserAlias model stores the map between sub values and User objects.

I mustn't have tested this since changing the way that user names are stored. I think we'll need to make a new LTI_13_Sub_AccessChange model instead of using UsernameAccessChange, so that we look at user alias fields. The AccessChangeManager.for_user method will have to take a resource argument as well, so it can look for user aliases in the right consumer.

christianp commented 2 months ago

No, we don't need to add a resource argument: you can use the instance field on the RelatedManager.