19 lines
440 B
Python
19 lines
440 B
Python
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from models.library import ExamRecord
|
|
from schemas.exam import ExamRecordRequest
|
|
|
|
|
|
async def add_record(db: AsyncSession, data: ExamRecordRequest) -> bool:
|
|
record = ExamRecord(
|
|
subject=data.subject,
|
|
total_count=data.totalCount,
|
|
correct_count=data.correctCount,
|
|
wrong_count=data.wrongCount,
|
|
)
|
|
|
|
db.add(record)
|
|
await db.commit()
|
|
|
|
return True
|