Commit f51876da by Brian Wilson

cosmetic changes

parent ab6f383b
...@@ -1166,7 +1166,6 @@ def test_center_login(request): ...@@ -1166,7 +1166,6 @@ def test_center_login(request):
'ETDBTM' : 'ADDDOUBLE', } 'ETDBTM' : 'ADDDOUBLE', }
time_accommodation_code = None time_accommodation_code = None
if registration.get_accommodation_codes():
for code in registration.get_accommodation_codes(): for code in registration.get_accommodation_codes():
if code in time_accommodation_mapping: if code in time_accommodation_mapping:
time_accommodation_code = time_accommodation_mapping[code] time_accommodation_code = time_accommodation_mapping[code]
......
...@@ -24,6 +24,7 @@ class StudentModule(models.Model): ...@@ -24,6 +24,7 @@ class StudentModule(models.Model):
MODULE_TYPES = (('problem', 'problem'), MODULE_TYPES = (('problem', 'problem'),
('video', 'video'), ('video', 'video'),
('html', 'html'), ('html', 'html'),
('timelimit', 'timelimit'),
) )
## These three are the key for the object ## These three are the key for the object
module_type = models.CharField(max_length=32, choices=MODULE_TYPES, default='problem', db_index=True) module_type = models.CharField(max_length=32, choices=MODULE_TYPES, default='problem', db_index=True)
......
...@@ -174,8 +174,7 @@ def check_for_active_timelimit_module(request, course_id, course): ...@@ -174,8 +174,7 @@ def check_for_active_timelimit_module(request, course_id, course):
location = timelimit_module.location location = timelimit_module.location
# determine where to go when the timer expires: # determine where to go when the timer expires:
if 'time_expired_redirect_url' not in timelimit_descriptor.metadata: if 'time_expired_redirect_url' not in timelimit_descriptor.metadata:
# TODO: provide a better error raise Http404("No {0} metadata at this location: {1} ".format('time_expired_redirect_url', location))
raise Http404
time_expired_redirect_url = timelimit_descriptor.metadata.get('time_expired_redirect_url') time_expired_redirect_url = timelimit_descriptor.metadata.get('time_expired_redirect_url')
context['time_expired_redirect_url'] = time_expired_redirect_url context['time_expired_redirect_url'] = time_expired_redirect_url
# Fetch the end time (in GMT) as stored in the module when it was started. # Fetch the end time (in GMT) as stored in the module when it was started.
...@@ -197,8 +196,7 @@ def update_timelimit_module(user, course_id, student_module_cache, timelimit_des ...@@ -197,8 +196,7 @@ def update_timelimit_module(user, course_id, student_module_cache, timelimit_des
context = {} context = {}
# determine where to go when the exam ends: # determine where to go when the exam ends:
if 'time_expired_redirect_url' not in timelimit_descriptor.metadata: if 'time_expired_redirect_url' not in timelimit_descriptor.metadata:
# TODO: provide a better error raise Http404("No {0} metadata at this location: {1} ".format('time_expired_redirect_url', timelimit_module.location))
raise Http404
time_expired_redirect_url = timelimit_descriptor.metadata.get('time_expired_redirect_url') time_expired_redirect_url = timelimit_descriptor.metadata.get('time_expired_redirect_url')
context['time_expired_redirect_url'] = time_expired_redirect_url context['time_expired_redirect_url'] = time_expired_redirect_url
...@@ -206,8 +204,7 @@ def update_timelimit_module(user, course_id, student_module_cache, timelimit_des ...@@ -206,8 +204,7 @@ def update_timelimit_module(user, course_id, student_module_cache, timelimit_des
if not timelimit_module.has_begun: if not timelimit_module.has_begun:
# user has not started the exam, so start it now. # user has not started the exam, so start it now.
if 'duration' not in timelimit_descriptor.metadata: if 'duration' not in timelimit_descriptor.metadata:
# TODO: provide a better error raise Http404("No {0} metadata at this location: {1} ".format('duration', timelimit_module.location))
raise Http404
# The user may have an accommodation that has been granted to them. # The user may have an accommodation that has been granted to them.
# This accommodation information should already be stored in the module's state. # This accommodation information should already be stored in the module's state.
duration = int(timelimit_descriptor.metadata.get('duration')) duration = int(timelimit_descriptor.metadata.get('duration'))
...@@ -295,7 +292,7 @@ def index(request, course_id, chapter=None, section=None, ...@@ -295,7 +292,7 @@ def index(request, course_id, chapter=None, section=None,
instance_module = get_instance_module(course_id, request.user, course_module, student_module_cache) instance_module = get_instance_module(course_id, request.user, course_module, student_module_cache)
save_child_position(course_module, chapter, instance_module) save_child_position(course_module, chapter, instance_module)
else: else:
raise Http404 raise Http404('No chapter descriptor found with name {}'.format(chapter))
chapter_module = course_module.get_child_by(lambda m: m.url_name == chapter) chapter_module = course_module.get_child_by(lambda m: m.url_name == chapter)
if chapter_module is None: if chapter_module is None:
......
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