Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 9811755

Browse files
committed
Add: save microparsons answers
1 parent eed9d3b commit 9811755

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

bookserver/crud.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
"unittest": "unittest_answers",
9292
"timedExam": "timed_exam",
9393
"webwork": "webwork_answers",
94+
"hparsonsAnswer": "microparsons_answers",
9495
}
9596

9697

bookserver/models.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,15 @@ class WebWorkAnswers(Base, CorrectAnswerMixin):
296296
__table_args__ = (Index("idx_div_sid_course_ww", "sid", "div_id", "course_name"),)
297297

298298

299+
# An answer to a fill-in-the-blank question.
300+
@register_answer_table
301+
class MicroParsonsAnswers(Base, CorrectAnswerMixin):
302+
__tablename__ = "microparsons_answers"
303+
# See answer_. TODO: what is the format?
304+
answer = Column(JSON, nullable=False)
305+
__table_args__ = (Index("idx_div_sid_course_mp", "sid", "div_id", "course_name"),)
306+
307+
299308
@register_answer_table
300309
class LpAnswers(Base, AnswerMixin):
301310
__tablename__ = "lp_answers"

bookserver/routers/rslogging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ async def log_book_event(
149149
entry.incorrect = 0
150150
entry.skipped = 0
151151
entry.time_taken = 0
152-
elif entry.event == "webwork":
152+
elif entry.event == "webwork" or entry.event == "hparsonsAnswer":
153153
entry.answer = json.loads(useinfo_dict["answer"])
154154

155155
valid_table = rcd.validator.from_orm(entry) # type: ignore

0 commit comments

Comments
 (0)