From: W. Trevor King Date: Wed, 6 Feb 2013 14:39:59 +0000 (-0500) Subject: answerdb: Timestamp answers X-Git-Tag: v0.1~32 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d4c4c257b49fce8ca9d5c809b23f305c8f69cdcd;p=quizzer.git answerdb: Timestamp answers This may provide insight into the learning process (e.g. after I reviewed the Git index, everyone started doing better). --- diff --git a/quizzer/answerdb.py b/quizzer/answerdb.py index 81af17c..c8c802f 100644 --- a/quizzer/answerdb.py +++ b/quizzer/answerdb.py @@ -15,6 +15,7 @@ # quizzer. If not, see . import codecs as _codecs +import datetime as _datetime import json as _json from . import __version__ @@ -55,9 +56,12 @@ class AnswerDatabase (dict): def add(self, question, answer, correct): if question.id not in self: self[question.id] = [] + timezone = _datetime.timezone.utc + timestamp = _datetime.datetime.now(tz=timezone).isoformat() self[question.id].append({ 'answer': answer, 'correct': correct, + 'timestamp': timestamp, }) def get_answered(self, questions):