|
@@ -14,7 +14,7 @@ def calctime(m_func):
|
|
start=time.time()
|
|
start=time.time()
|
|
res=m_func(*args,**kwargs)
|
|
res=m_func(*args,**kwargs)
|
|
end=time.time()
|
|
end=time.time()
|
|
- print(m_func.__name__+" spend time is "+str(end-start))
|
|
|
|
|
|
+ # print(m_func.__name__+" spend time is "+str(end-start))
|
|
return res
|
|
return res
|
|
return decorter
|
|
return decorter
|
|
|
|
|
|
@@ -106,13 +106,13 @@ def getQuesitons(courseCode, groupCode, questionId):
|
|
|
|
|
|
def solveexamRecord(examRecorddetail):
|
|
def solveexamRecord(examRecorddetail):
|
|
record = bs4.BeautifulSoup(open(common.resource_path(os.path.join("template","template.html")), "r", encoding="utf-8"), features="html.parser")
|
|
record = bs4.BeautifulSoup(open(common.resource_path(os.path.join("template","template.html")), "r", encoding="utf-8"), features="html.parser")
|
|
|
|
+ identityNumber = examRecorddetail["identityNumber"]
|
|
studentName = examRecorddetail["studentName"]
|
|
studentName = examRecorddetail["studentName"]
|
|
examrRecordDataId = examRecorddetail["id"]
|
|
examrRecordDataId = examRecorddetail["id"]
|
|
- print("start to solve" + str(examrRecordDataId))
|
|
|
|
|
|
+ # print("Start examRecordDataId" + str(examrRecordDataId))
|
|
courseCode = examRecorddetail["courseCode"]
|
|
courseCode = examRecorddetail["courseCode"]
|
|
courseName = examRecorddetail["courseName"]
|
|
courseName = examRecorddetail["courseName"]
|
|
studentCode = examRecorddetail["studentCode"]
|
|
studentCode = examRecorddetail["studentCode"]
|
|
- print(examrRecordDataId)
|
|
|
|
result=findExamRecordDataEntity(examrRecordDataId)
|
|
result=findExamRecordDataEntity(examrRecordDataId)
|
|
#print(result)
|
|
#print(result)
|
|
groupCode = result["examRecord"]["paperType"]
|
|
groupCode = result["examRecord"]["paperType"]
|
|
@@ -216,7 +216,7 @@ def solveexamRecord(examRecorddetail):
|
|
|
|
|
|
if questionType == "SINGLE_CHOICE" or questionType == "MULTIPLE_CHOICE":
|
|
if questionType == "SINGLE_CHOICE" or questionType == "MULTIPLE_CHOICE":
|
|
correctAnswer=quesitonEntity["correctAnswer"]
|
|
correctAnswer=quesitonEntity["correctAnswer"]
|
|
- print(correctAnswer,studentAnswer)
|
|
|
|
|
|
+ # print(correctAnswer,studentAnswer)
|
|
|
|
|
|
rightAnswerdivcontent.append(
|
|
rightAnswerdivcontent.append(
|
|
selectorder(correctAnswer,optionorder))
|
|
selectorder(correctAnswer,optionorder))
|
|
@@ -224,7 +224,7 @@ def solveexamRecord(examRecorddetail):
|
|
selectorder(studentAnswer,optionorder))
|
|
selectorder(studentAnswer,optionorder))
|
|
elif questionType=="TRUE_OR_FALSE":
|
|
elif questionType=="TRUE_OR_FALSE":
|
|
f=lambda x: "" if not x else "正确" if x=="true" else "错误"
|
|
f=lambda x: "" if not x else "正确" if x=="true" else "错误"
|
|
- print(f(rightAnswer[0]))
|
|
|
|
|
|
+ # print(f(rightAnswer[0]))
|
|
rightAnswerdivcontent.append(f(rightAnswer[0]))
|
|
rightAnswerdivcontent.append(f(rightAnswer[0]))
|
|
studentAnswercontentspan.append(f(studentAnswer))
|
|
studentAnswercontentspan.append(f(studentAnswer))
|
|
else:
|
|
else:
|
|
@@ -244,16 +244,16 @@ def solveexamRecord(examRecorddetail):
|
|
fp.write(record.prettify())
|
|
fp.write(record.prettify())
|
|
if not os.path.exists(config.outputpath+os.sep+str(config.examId)):
|
|
if not os.path.exists(config.outputpath+os.sep+str(config.examId)):
|
|
os.makedirs(config.outputpath+os.sep+str(config.examId))
|
|
os.makedirs(config.outputpath+os.sep+str(config.examId))
|
|
- filepath=config.outputpath+os.sep+str(config.examId)+os.sep+str(examrRecordDataId)+".pdf"
|
|
|
|
|
|
+ filepath=config.outputpath+os.sep+str(config.examId)+os.sep+identityNumber+'_'+studentName+".pdf"
|
|
common.convert_to_pdf(common.resource_path(os.path.join("template","temp.html")),filepath)
|
|
common.convert_to_pdf(common.resource_path(os.path.join("template","temp.html")),filepath)
|
|
- print("finish solve" + str(examrRecordDataId))
|
|
|
|
|
|
+ print("Finish examRecordDataId " + str(examrRecordDataId))
|
|
|
|
|
|
|
|
|
|
def selectorder(answer,optionpremutation):
|
|
def selectorder(answer,optionpremutation):
|
|
if answer:
|
|
if answer:
|
|
answerstr=[]
|
|
answerstr=[]
|
|
for answerorder in answer:
|
|
for answerorder in answer:
|
|
- print(optionpremutation)
|
|
|
|
|
|
+ # print(optionpremutation)
|
|
index=optionpremutation.index(int(answerorder))
|
|
index=optionpremutation.index(int(answerorder))
|
|
answerstr.append(chr(65+index))
|
|
answerstr.append(chr(65+index))
|
|
answerstr.sort()
|
|
answerstr.sort()
|