From d0c8722da4c0ecd508d0951472295569d9eab243 Mon Sep 17 00:00:00 2001 From: Piotr Mitros Date: Tue, 24 Jan 2012 20:16:06 -0500 Subject: [PATCH] Revert reversed. Database insert vs. update bug fixed --- courseware/module_render.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/courseware/module_render.py b/courseware/module_render.py index 05d83d08ae..4c969447a1 100644 --- a/courseware/module_render.py +++ b/courseware/module_render.py @@ -107,17 +107,17 @@ def render_x_module(user, request, xml_module, module_object_preload): module_id=xml_module.get('id') #module_class.id_attribute) or "" # Grab state from database - #s = object_cache(module_object_preload, - # user, - # module_type, - # module_id) - s = StudentModule.objects.filter(student=request.user, - module_id=module_id, - module_type = module_type) - if len(s) == 0: - s=None - else: - s=s[0] + s = object_cache(module_object_preload, + user, + module_type, + module_id) + # s = StudentModule.objects.filter(student=request.user, + # module_id=module_id, + # module_type = module_type) + # if len(s) == 0: + # s=None + # else: + # s=s[0] if s == None: # If nothing in the database... state=None @@ -141,6 +141,7 @@ def render_x_module(user, request, xml_module, module_object_preload): module_id=module_id, state=instance.get_state()) smod.save() # This may be optional (at least in the case of no instance in the dB) + module_object_preload.append(smod) # Grab content content = {'content':instance.get_html(), "destroy_js":instance.get_destroy_js(),