database_tools中的目标字段使用蓝色tcolorbox

This commit is contained in:
weiye.wang 2023-08-14 08:49:09 +08:00
parent c9fc029c9a
commit 9c3a666e4d
1 changed files with 12 additions and 8 deletions

View File

@ -745,7 +745,7 @@ 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表示保留得分率最高的使用记录与最低的使用记录的个数, 有负数表示不排列 def TeachersGetAfterContent(id,prodict,objdict,topandbottomusagestuple = (3,3), showobjs = True, showtags = True, showans = True, showsolution = True, showusages = True, showorigin = True, showremark = True): #生成教师版讲义后的答案及空格, topandbottomusagestuple表示保留得分率最高的使用记录与最低的使用记录的个数, 有负数表示不排列
string = "" string = ""
objs = ("目标:\n\n%s\n\n"%GenerateObjTexCode(id,prodict,objdict)) if showobjs else "" 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 "" 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 "" 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 "" solution = ("解答或提示: \\textcolor{magenta}{%s}\n\n"%(prodict[id]["solution"] if prodict[id]["solution"] != "" else "暂无解答")) if showsolution else ""
@ -756,13 +756,17 @@ def TeachersGetAfterContent(id,prodict,objdict,topandbottomusagestuple = (3,3),
return string #生成教师版讲义后的答案及空格 return string #生成教师版讲义后的答案及空格
def GenerateObjTexCode(id,prodict,objdict): #生成目标代号对应的学习目标字符串(含蓝色编码) def GenerateObjTexCode(id,prodict,objdict): #生成目标代号对应的学习目标字符串(含蓝色编码)
string = "" # string = ""
if prodict[id]["objs"] != []: # if prodict[id]["objs"] != []:
for objid in prodict[id]["objs"]: string = "\n\\begin{tcolorbox}[colback = blue!10!white, colframe = blue!50!black, breakable]\n目标:"
if objid.upper() == "KNONE": for objid in prodict[id]["objs"]:
string += "\\textcolor{blue}{%s\t%s}\n\n"%(objid,"无当前有效关联目标") if objid.upper() == "KNONE":
else: string += "\n\n%s\t%s"%(objid,"无当前有效关联目标")
string += "\\textcolor{blue}{%s\t%s}\n\n"%(objid,objdict[objid]["content"]) else:
string += "\n\n%s\t%s"%(objid,objdict[objid]["content"])
if prodict[id]["objs"] == []:
string += "暂未关联\n"
string += "\n\n\\end{tcolorbox}\n"
return string #返回目标代码字符串 return string #返回目标代码字符串
def ChooseUsage(usages,topandbottomusagestuple): #生成题号对应的题目的使用记录, topandbottomusagestuple表示保留得分率最高的使用记录与最低的使用记录的个数, 有负数表示不排列, 两数之和大于记录数则从高到低排列后全部展示 def ChooseUsage(usages,topandbottomusagestuple): #生成题号对应的题目的使用记录, topandbottomusagestuple表示保留得分率最高的使用记录与最低的使用记录的个数, 有负数表示不排列, 两数之和大于记录数则从高到低排列后全部展示