添加新题和关联题的origin更新为最新版
This commit is contained in:
parent
439c5af4f0
commit
433533c5e9
|
|
@ -411,7 +411,7 @@ def AddProblemstoDict(startingid,raworigin,problems,editor,indexdescription,thed
|
|||
return 0
|
||||
|
||||
|
||||
def AddProblemstoDict2024(startingid,raworigin,problems,editor,indexdescription,thedict): #将来自GenerateProblemListFromString的列表中的题目添加到thedict字典, 返回题号列表(包括用老题号替代的题目)
|
||||
def AddProblemstoDict2024(startingid,raworigin,problems,editor,indexed,thedict): #将来自GenerateProblemListFromString的列表中的题目添加到thedict字典, 返回题号列表(包括用老题号替代的题目)
|
||||
idlist = []
|
||||
id = int(startingid)
|
||||
currentsuffix = problems[0][1]
|
||||
|
|
@ -428,7 +428,10 @@ def AddProblemstoDict2024(startingid,raworigin,problems,editor,indexdescription,
|
|||
else:
|
||||
problemindex = 1
|
||||
currentsuffix = suffix
|
||||
origin = raworigin + suffix + indexdescription.strip() + ("" if indexdescription.strip() == "" else str(problemindex))
|
||||
if indexed:
|
||||
origin = {"来源": raworigin + suffix, "题号": problemindex}
|
||||
else:
|
||||
origin = {"来源": raworigin + suffix}
|
||||
if not "rep" in meta:
|
||||
newproblem = CreateNewProblem(pid,p.strip(),origin,thedict,GetDate() + "\t" + editor)
|
||||
if "blank" in p:
|
||||
|
|
@ -486,7 +489,7 @@ def CreateRelatedProblems(links,thedict,filepath,editor): # 根据links关联生
|
|||
new_dict[old_id]["same"] = []
|
||||
new_dict[old_id]["unrelated"] = []
|
||||
new_dict[old_id]["edit"] = new_dict[old_id]["edit"].copy() + [GetDate()+"\t"+editor]
|
||||
new_dict[old_id]["origin"] += "-" + GetDate() + "修改"
|
||||
new_dict[old_id]["origin"] = {"来源": "改编题目", "前序": old_id}
|
||||
save_dict(new_dict,filepath)
|
||||
except:
|
||||
return 1 #异常返回1
|
||||
|
|
|
|||
|
|
@ -24,13 +24,13 @@ class MyWindow(QWidget,Ui_Form):
|
|||
filename = "临时文件/新题比对.tex" #题目的来源.tex文件
|
||||
editor = self.lineEdit_editor.text().strip()
|
||||
if self.checkBox_suffix.isChecked():
|
||||
IndexDescription = self.lineEdit_suffix.text().strip()
|
||||
Indexed = True
|
||||
else:
|
||||
IndexDescription = ""
|
||||
Indexed = False
|
||||
idlistpath = "文本文件/新题收录列表.txt"
|
||||
problems = GenerateProblemListFromString2024(ReadTextFile(filename))
|
||||
pro_dict = load_dict("../题库0.3/Problems.json")
|
||||
idlist = AddProblemstoDict2024(NextSpareID(starting_id,pro_dict),raworigin,problems,editor,IndexDescription,pro_dict)
|
||||
idlist = AddProblemstoDict2024(NextSpareID(starting_id,pro_dict),raworigin,problems,editor,Indexed,pro_dict)
|
||||
save_dict(SortDict(pro_dict),r"../题库0.3/Problems.json")
|
||||
AppendTextFile(f"{GetDate()}-{GetTime()}\n{generate_exp(idlist)}",idlistpath)
|
||||
os.system(f"code {idlistpath}")
|
||||
|
|
|
|||
Reference in New Issue