From 673cc2bbb393b3cff6d3f7c2e5e8cbd3837bd73f Mon Sep 17 00:00:00 2001 From: kimth Date: Thu, 23 Aug 2012 17:43:38 -0400 Subject: [PATCH] Keep queueuing time --- common/lib/capa/capa/correctmap.py | 3 +++ common/lib/capa/capa/responsetypes.py | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/common/lib/capa/capa/correctmap.py b/common/lib/capa/capa/correctmap.py index c6fc98e62f..4659e2d1e2 100644 --- a/common/lib/capa/capa/correctmap.py +++ b/common/lib/capa/capa/correctmap.py @@ -73,6 +73,9 @@ class CorrectMap(object): def is_right_queuekey(self, answer_id, test_key): return self.is_queued(answer_id) and self.cmap[answer_id]['queuestate'][0] == test_key + def get_queuetime_str(self, answer_id): + return self.cmap[answer_id]['queuestate'][1] if self.is_queued(answer_id) else None + def get_npoints(self, answer_id): npoints = self.get_property(answer_id, 'npoints') if npoints is not None: diff --git a/common/lib/capa/capa/responsetypes.py b/common/lib/capa/capa/responsetypes.py index 35b8688a7b..27801ad871 100644 --- a/common/lib/capa/capa/responsetypes.py +++ b/common/lib/capa/capa/responsetypes.py @@ -1149,7 +1149,10 @@ class CodeResponse(LoncapaResponse): (error, msg) = qinterface.send_to_queue(header=xheader, body=json.dumps(contents)) - queuestate = (queuekey,'') + # State associated with the queueing request + qtime = datetime.strftime(datetime.now(), '%Y%m%d%H%M%S') + queuestate = (queuekey, qtime) + cmap = CorrectMap() if error: cmap.set(self.answer_id, queuestate=None,