Commit 42050c40 by kimth

Keep queueuing time

parent 6a12b9bb
...@@ -73,6 +73,9 @@ class CorrectMap(object): ...@@ -73,6 +73,9 @@ class CorrectMap(object):
def is_right_queuekey(self, answer_id, test_key): def is_right_queuekey(self, answer_id, test_key):
return self.is_queued(answer_id) and self.cmap[answer_id]['queuestate'][0] == 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): def get_npoints(self, answer_id):
npoints = self.get_property(answer_id, 'npoints') npoints = self.get_property(answer_id, 'npoints')
if npoints is not None: if npoints is not None:
......
...@@ -1149,7 +1149,10 @@ class CodeResponse(LoncapaResponse): ...@@ -1149,7 +1149,10 @@ class CodeResponse(LoncapaResponse):
(error, msg) = qinterface.send_to_queue(header=xheader, (error, msg) = qinterface.send_to_queue(header=xheader,
body=json.dumps(contents)) 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() cmap = CorrectMap()
if error: if error:
cmap.set(self.answer_id, queuestate=None, cmap.set(self.answer_id, queuestate=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