修改入口文件main.go,更新了用户处理器和考试服务的逻辑,同时修改了成绩服务的实现。请注意,config.yaml文件有未暂存的更改,需要先将其添加到暂存区才能提交。
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"exam_registration/internal/dao"
|
||||
"exam_registration/internal/model"
|
||||
"errors"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type ScoreService struct{}
|
||||
@@ -22,7 +23,7 @@ func (s *ScoreService) CreateScore(score *model.ExamScore) error {
|
||||
}
|
||||
|
||||
func (s *ScoreService) BatchCreateScores(scores []model.ExamScore) error {
|
||||
return dao.DB.Transaction(func(tx *dao.DB) error {
|
||||
return dao.DB.Transaction(func(tx *gorm.DB) error {
|
||||
for i := range scores {
|
||||
scores[i].Pass = scores[i].Score >= 60
|
||||
|
||||
|
||||
Reference in New Issue
Block a user