From 2f47a9e7e23e02846fcac84975ddc628982356bb Mon Sep 17 00:00:00 2001 From: pooneyy <85266337+pooneyy@users.noreply.github.com> Date: Sun, 17 Sep 2023 18:12:32 +0800 Subject: [PATCH] Update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 题库开始记录选项id --- README.md | 4 +++- Utils.py | 2 ++ importOneReviewPaper.py | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 136c847..374140e 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,9 @@ 运行`exportData.py`,按照提示操作。 -### 更新日志 +### 代码更新日志 - 2023.09.17 - 更新`importData.py`获取题库的方式,登录相关的代码来自[Coaixy/weiban-tool](https://github.com/Coaixy/weiban-tool) + - 题库开始记录选项id + diff --git a/Utils.py b/Utils.py index 49dfea0..c6296c4 100644 --- a/Utils.py +++ b/Utils.py @@ -98,11 +98,13 @@ def getPaperDetails(self): userQuestionsBank[i['id']] = {} userQuestionsBank[i['id']]['question'] = i['title'] userQuestionsBank[i['id']]['answer'] = [] + userQuestionsBank[i['id']]['answerIds'] = [] userQuestionsBank[i['id']]['type'] = i['type'] userQuestionsBank[i['id']]['typeLabel'] = i['typeLabel'] for j in i['optionList']: if j['isCorrect'] == 1: userQuestionsBank[i['id']]['answer'].append(j['content']) + userQuestionsBank[i['id']]['answerIds'].append(j['id']) return userQuestionsBank def fill_key(key): diff --git a/importOneReviewPaper.py b/importOneReviewPaper.py index 947e883..4ba8278 100644 --- a/importOneReviewPaper.py +++ b/importOneReviewPaper.py @@ -26,11 +26,13 @@ def getPaperDetails(data): userQuestionsBank[i['id']] = {} userQuestionsBank[i['id']]['question'] = i['title'] userQuestionsBank[i['id']]['answer'] = [] + userQuestionsBank[i['id']]['answerIds'] = [] userQuestionsBank[i['id']]['type'] = i['type'] userQuestionsBank[i['id']]['typeLabel'] = i['typeLabel'] for j in i['optionList']: if j['isCorrect'] == 1: userQuestionsBank[i['id']]['answer'].append(j['content']) + userQuestionsBank[i['id']]['answerIds'].append(j['id']) return userQuestionsBank def main():