From 9768e3c9c1cfdcff0201a1cb8b9f3da935031fc7 Mon Sep 17 00:00:00 2001 From: wangweiye7840 Date: Wed, 27 Mar 2024 14:46:28 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AD=94=E9=A2=98=E7=BA=B8=E5=AF=B9=E5=BA=94?= =?UTF-8?q?=E4=B8=AD=E5=8F=AF=E4=BB=A5=E8=AE=BE=E7=BD=AEexclude=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE,=20=E4=B8=8D=E5=BD=95=E5=85=A5=E6=9F=90=E4=BA=9B?= =?UTF-8?q?=E9=A2=98=E5=8F=B7=E6=9F=90=E4=BA=9B=E7=8F=AD=E7=BA=A7=E7=9A=84?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 工具v2/database_tools.py | 4 ++-- 工具v2/获取小闲平台使用数据new.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/工具v2/database_tools.py b/工具v2/database_tools.py index 615aa0ce..167e2d3c 100644 --- a/工具v2/database_tools.py +++ b/工具v2/database_tools.py @@ -1917,7 +1917,7 @@ def generateIDtoUsageCorrespondence(idlist,validcols,names): #根据idlist(题 corr_dict[idlist[i]] = collist return corr_dict -def CalculateUsages(statsfilepathlist,statsfilename,gradename,threshold,marks,correspondence_dict,validcols,date): #根据统计数据所在的路径,文件名,年级,阈值,分数列表和题号列数(0-len(validcols))对应字典,以及原excel文件中的有效列位置validcols, 日期date, 生成usages的metadata.txt文件的内容, 如果有正确率大于1的则返回False +def CalculateUsages(statsfilepathlist,statsfilename,gradename,threshold,marks,correspondence_dict,validcols,date,exclude = {}): #根据统计数据所在的路径,文件名,年级,阈值,分数列表和题号列数(0-len(validcols))对应字典,以及原excel文件中的有效列位置validcols, 日期date, 生成usages的metadata.txt文件的内容, 如果有正确率大于1的则返回False output = "usages\n\n\n" validflag = True marks = [int(mark) for mark in marks] @@ -1933,7 +1933,7 @@ def CalculateUsages(statsfilepathlist,statsfilename,gradename,threshold,marks,co means_out = [f"{t:.3f}" for t in means] for id in correspondence_dict: cols = correspondence_dict[id] - if not len(cols) == 0: + if not len(cols) == 0 and not (id in exclude and classname[-3:] in generate_classid(exclude[id])): diffs = "\t".join([means_out[u] for u in cols]) usages = f"{date}\t{classname}\t{diffs}" output += f"{id}\n{usages}\n\n\n" diff --git a/工具v2/获取小闲平台使用数据new.py b/工具v2/获取小闲平台使用数据new.py index adb606af..43611cec 100644 --- a/工具v2/获取小闲平台使用数据new.py +++ b/工具v2/获取小闲平台使用数据new.py @@ -133,6 +133,8 @@ class MyWindow(QWidget,Ui_Form): paperinfo = FindPaper(xiaoxianpid, self.answersheetseekingpath) gradename = paperinfo[1] idlist = paperinfo[2] + excludejson = paperinfo[4] + print(paperinfo) # print(paperinfo) zf = zipfile.ZipFile(zipfilepath) zf.extractall(self.tempdir) #解压zip文件中的所有内容到tempdir @@ -141,7 +143,7 @@ class MyWindow(QWidget,Ui_Form): validcols,marks = generateColIndexandMarks(statsfilepathlist,self.statsfilename,paperinfo) dfcurrent = pd.read_excel(os.path.join(statsfilepathlist[0],self.statsfilename)) correspondence_dict = generateIDtoUsageCorrespondence(idlist,validcols,dfcurrent.iloc[1,validcols]) - output = CalculateUsages(statsfilepathlist,self.statsfilename,gradename,threshold,marks,correspondence_dict,validcols,date) + output = CalculateUsages(statsfilepathlist,self.statsfilename,gradename,threshold,marks,correspondence_dict,validcols,date,exclude=excludejson) return output #返回由usages开始的使用记录文本 except: return 1 #无法生成就返回1