From c1630561a03db79a01804cde52d666d87cba8876 Mon Sep 17 00:00:00 2001 From: "weiye.wang" Date: Mon, 14 Aug 2023 13:57:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9database=5Ftools=E4=BD=BF?= =?UTF-8?q?=E6=95=99=E5=B8=88=E8=AE=B2=E4=B9=89=E5=88=B6=E4=BD=9C=E9=9D=9E?= =?UTF-8?q?=E9=A2=98=E7=9B=AE=E9=83=A8=E5=88=86=E9=83=BD=E4=BB=A5=E8=89=B2?= =?UTF-8?q?=E5=9D=97=E4=B8=BA=E8=83=8C=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 工具v2/database_tools.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/工具v2/database_tools.py b/工具v2/database_tools.py index b117e335..83f5b1c3 100644 --- a/工具v2/database_tools.py +++ b/工具v2/database_tools.py @@ -746,19 +746,20 @@ def GenerateStudentBodyString(problems,sectiontitles,pro_dict,consecutivenumberi def TeachersGetAfterContent(id,prodict,objdict,topandbottomusagestuple = (3,3), showobjs = True, showtags = True, showans = True, showsolution = True, showusages = True, showorigin = True, showremark = True): #生成教师版讲义后的答案及空格, topandbottomusagestuple表示保留得分率最高的使用记录与最低的使用记录的个数, 有负数表示不排列 string = "" objs = GenerateObjTexCode(id,prodict,objdict) if showobjs else "" - tags = ("标签: \\textcolor[rgb]{0.5,0.6,0.8}{%s}\n\n"%("; ".join(prodict[id]["tags"])) if not prodict[id]["tags"] == [] else "标签: \n\n") if showtags else "" - ans = ("答案: \\textcolor{red}{%s}\n\n"%(prodict[id]["ans"] if prodict[id]["ans"] != "" else "暂无答案")) if showans else "" - solution = ("解答或提示: \\textcolor{magenta}{%s}\n\n"%(prodict[id]["solution"] if prodict[id]["solution"] != "" else "暂无解答")) if showsolution else "" - origin = ("来源: %s\n\n"%prodict[id]["origin"]) if showorigin else "" - remark = ("备注: \\textcolor[rgb]{0,0.5,0.2}{%s}\n\n"%(prodict[id]["remark"] if prodict[id]["remark"] != "" else "暂无备注")) if showremark else "" - usages = ("使用记录:\n\n%s\n\n"%GenerateUsageTexCode(id,prodict,topandbottomusagestuple)) if showusages else "" + tags = ("\\begin{tcolorbox}[colback = orange!10!white, colframe = orange!10!white, breakable]\n标签: %s\n\n\\end{tcolorbox}\n"%("; ".join(prodict[id]["tags"]))) if showtags else "" + ans = ("\\begin{tcolorbox}[colback = red!10!white, colframe = red!10!white, breakable]\n答案: %s\n\n\\end{tcolorbox}\n"%(prodict[id]["ans"] if prodict[id]["ans"] != "" else "暂无答案")) if showans else "" + solution = ("\\begin{tcolorbox}[colback = green!10!white, colframe = green!10!white, breakable]\n解答或提示: %s\n\n\\end{tcolorbox}\n"%(prodict[id]["solution"] if prodict[id]["solution"] != "" else "暂无解答")) if showsolution else "" + # solution = ("解答或提示: \\textcolor{magenta}{%s}\n\n"%(prodict[id]["solution"] if prodict[id]["solution"] != "" else "暂无解答")) if showsolution else "" + origin = ("\\begin{tcolorbox}[colback = yellow!30!white, colframe = yellow!30!white, breakable]\n来源: %s\n\n\\end{tcolorbox}\n"%prodict[id]["origin"]) if showorigin else "" + remark = ("\\begin{tcolorbox}[colback = cyan!30!white, colframe = cyan!30!white, breakable]\n备注: %s\n\n\\end{tcolorbox}\n"%(prodict[id]["remark"] if prodict[id]["remark"] != "" else "暂无备注")) if showremark else "" + usages = ("\\begin{tcolorbox}[colback = lime!10!white, colframe = lime!10!white, breakable]\n使用记录(%s):\n\n%s\n\n\\end{tcolorbox}\n"%(str(topandbottomusagestuple),GenerateUsageTexCode(id,prodict,topandbottomusagestuple))) if showusages else "" string += objs + tags + ans + solution + usages + origin + remark return string #生成教师版讲义后的答案及空格 def GenerateObjTexCode(id,prodict,objdict): #生成目标代号对应的学习目标字符串(含蓝色编码) # string = "" # if prodict[id]["objs"] != []: - string = "\n\\begin{tcolorbox}[colback = blue!10!white, colframe = blue!50!black, breakable]\n目标:" + string = "\n\\begin{tcolorbox}[colback = blue!10!white, colframe = blue!10!white, breakable]\n目标:" for objid in prodict[id]["objs"]: if objid.upper() == "KNONE": string += "\n\n%s\t%s"%(objid,"无当前有效关联目标")