统计分析模块更新,待测试,优化所有模块main.py文件,修复bug。
This commit is contained in:
@@ -35,7 +35,7 @@ def get_students(g:get_student_dao = Depends()
|
||||
,description=f'查询每次考试成绩都在80分以上的学生的编号,姓名和成绩。'
|
||||
)
|
||||
def get_students(db=Depends(get_db)):
|
||||
result = get_student_dao( db=db )
|
||||
result = get_score_80( db=db )
|
||||
if result:
|
||||
return result
|
||||
raise HTTPException(status_code=404, detail="没有找到符合条件的学生")
|
||||
|
||||
@@ -39,9 +39,11 @@ def get_class_count(g , db):
|
||||
from scores.model.score_model import Score
|
||||
|
||||
def get_score_80(db):
|
||||
q = (db.query(Score)
|
||||
.filter(Score.score>=80)
|
||||
.all())
|
||||
q = ( db.query(Score)
|
||||
.group_by(Score.score)
|
||||
.having( min(Score.score) >= 80)
|
||||
.all()
|
||||
)
|
||||
return q
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from fastapi import FastAPI,APIRouter
|
||||
from StatCalc.api.statcalc_api import statcalc_api
|
||||
from databases import *
|
||||
from StatCalc.model import statcalc_model
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
StatCalc_API = APIRouter()
|
||||
|
||||
Reference in New Issue
Block a user