ug fixes to StudentModel caching. Added cache-update on db-update because we do POST/GET pairings for submitting answers and checking them.

--HG--
branch : dormsbee_performance
This commit is contained in:
David Ormsbee
2012-02-24 14:32:32 -05:00
parent 1bfd1d78ae
commit 6ad93db8ce
2 changed files with 30 additions and 22 deletions

View File

@@ -48,13 +48,13 @@ def make_track_function(request):
def modx_dispatch(request, module=None, dispatch=None, id=None):
''' Generic view for extensions. '''
# Grab the student information for the module from the database
s = StudentModule.objects.filter(student=request.user,
module_id=id)
if len(s) == 0:
#s = StudentModule.objects.filter(student=request.user,
# module_id=id)
s = StudentModule.get_from_cache(request.user, id)
if s is None:
log.debug("Couldnt find module for user and id " + str(module) + " " + str(request.user) + " "+ str(id))
raise Http404
s=s[0]
oldgrade = s.grade
oldstate = s.state