合并达成度功能

This commit is contained in:
2025-05-20 18:30:00 +08:00
parent 8d063fd08a
commit 0a9bd74d8e
20 changed files with 14934 additions and 47 deletions
+15 -1
View File
@@ -1,5 +1,6 @@
import random
from typing import Optional
from typing import Optional, Tuple
from openpyxl.reader.excel import load_workbook
@@ -31,6 +32,7 @@ class Question:
if row[0] is None and row[1] is None:
break
questions.append(Question(*row))
wb.close()
return questions
@property
@@ -64,6 +66,7 @@ class Student:
students = []
for row in ws.iter_rows(min_row=6, max_col=5, values_only=True):
students.append(Student(*row))
wb.close()
return [x for x in students if x.valid]
@property
@@ -115,6 +118,7 @@ class Course:
wb = load_workbook(path, read_only=True)
ws = wb.active
name: str = ws['E3'].value
wb.close()
return Course(name[5:])
@property
@@ -122,5 +126,15 @@ class Course:
return self._name
class Performance:
def __init__(self, scores: Tuple[float, float, float], rates: Tuple[float, float, float], achievement: float):
self.scores = scores # (平时平均分, 大作业平均分, 试卷平均分)
self.rates = rates # (平时得分率, 大作业得分率, 试卷得分率)
self.achievement = achievement # 达成度
def __str__(self):
return f"Performance(scores={self.scores}, rates={self.rates}, achievement={self.achievement})"
if __name__ == '__main__':
...