v1.2版本更新发布

This commit is contained in:
2026-04-22 00:59:29 +08:00
parent 194c076456
commit 4121e9624f
26 changed files with 1323 additions and 61 deletions

View File

@@ -9,6 +9,7 @@
# 版权所有 © Sea Network Technology Studio
# ===========================================
import math
from typing import Dict, Any, Optional, List
from models.user import UserModel
@@ -93,22 +94,27 @@ class ParentService:
# 获取全班排名
ranking = await StudentModel.get_ranking(limit=1000)
total_students = await StudentModel.get_total_count()
# 查找当前学生排名
student_rank = None
total_students = 0
for r in ranking:
total_students += 1
if r["student_id"] == user["student_id"]:
student_rank = r["rank"]
# 计算百分比排名
percentile = None
if student_rank and total_students and total_students > 0:
percentile = math.ceil(student_rank / total_students * 100)
return {
"student_id": student["student_id"],
"student_name": student["name"],
"student_no": student["student_no"],
"total_points": student["total_points"],
"rank": student_rank,
"total_students": total_students
"total_students": total_students,
"percentile": percentile
}
@staticmethod