answerdb: Timestamp answers
authorW. Trevor King <wking@tremily.us>
Wed, 6 Feb 2013 14:39:59 +0000 (09:39 -0500)
committerW. Trevor King <wking@tremily.us>
Wed, 6 Feb 2013 14:39:59 +0000 (09:39 -0500)
This may provide insight into the learning process (e.g. after I
reviewed the Git index, everyone started doing better).

quizzer/answerdb.py

index 81af17c6effe09713648086c7b27ce1e4650a65a..c8c802f9bc3606d012823cd3a7a8d53e469a7f7e 100644 (file)
@@ -15,6 +15,7 @@
 # quizzer.  If not, see <http://www.gnu.org/licenses/>.
 
 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):