Commit 88a30cb7 by David Ormsbee

Fixes in response to Victor's comments.

parent 87784d1c
......@@ -67,6 +67,8 @@ class StudentModuleHistory(models.Model):
Student. Right now, we restrict this to problems so that the table doesn't
explode in size."""
HISTORY_SAVING_TYPES = {'problem'}
class Meta:
get_latest_by = "created"
......@@ -81,7 +83,7 @@ class StudentModuleHistory(models.Model):
@receiver(post_save, sender=StudentModule)
def save_history(sender, instance, **kwargs):
if instance.module_type == 'problem':
if instance.module_type in StudentModuleHistory.HISTORY_SAVING_TYPES:
history_entry = StudentModuleHistory(student_module=instance,
version=None,
created=instance.modified,
......
......@@ -616,10 +616,11 @@ def submission_history(request, course_id, student_username, location):
Right now this only works for problems because that's all
StudentModuleHistory records.
"""
# Make sure our has_access check uses the course_id, eh? or is ourself
course = get_course_with_access(request.user, course_id, 'load')
staff_access = has_access(request.user, course, 'staff')
# Permission Denied if they don't have staff access and are trying to see
# somebody else's submission history.
if (student_username != request.user.username) and (not staff_access):
raise PermissionDenied
......
......@@ -4,7 +4,7 @@
% for i, entry in enumerate(history_entries):
<hr/>
<div>
<b>#${len(history_entries) - i}</b>: ${entry.created} EST</br>
<b>#${len(history_entries) - i}</b>: ${entry.created} UTC</br>
Score: ${entry.grade} / ${entry.max_grade}
<pre>
${json.dumps(json.loads(entry.state), indent=2, sort_keys=True) | h}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment