This commit is contained in:
Leufolium 2024-07-25 20:11:38 +08:00
parent 2ea3ebb6aa
commit bb2c18fa4b
2 changed files with 11 additions and 7 deletions

View File

@ -42,10 +42,9 @@ type ClassResult struct {
}
type ClassInfo struct {
ClassId int64 `json:"class_id"` // 大类id
ClassName string `json:"class_name"` // 大类名称
ClassTotalScore int64 `json:"class_total_score"` // 大类总分
ClassFullScore int64 `json:"class_full_score"` // 大类满分
ClassId int64 `json:"class_id"` // 大类id
ClassName string `json:"class_name"` // 大类名称
ClassFullScore int64 `json:"class_full_score"` // 大类满分
}
type Suggestion struct {
@ -61,5 +60,6 @@ type Tip struct {
type ClassResultMapCfg struct {
Map map[int64]*ClassResult `json:"map"`
ClassInfoMap map[int64]*ClassInfo `json:"class_info_map"`
FullScore int64 `json:"full_score"` // 满分
FullScore int64 `json:"full_score"` // 满分
TotalScore int64 `json:"total_score"` // 总分
}

View File

@ -3626,7 +3626,7 @@ func (s *Service) ApiCreateRavenIQTest(ctx *gin.Context, req *Raven_IQ_testproto
totalScore := float64(0)
for classId, score := range classScoreMap {
classInfo := classResultMpCfg.ClassInfoMap[classId]
covertedScore := int64(math.Ceil(((float64(score) / float64(classInfo.ClassTotalScore) * float64(classResultMpCfg.FullScore)) + float64(classInfo.ClassFullScore)) / 2))
covertedScore := int64(math.Ceil(((float64(score) / float64(classResultMpCfg.TotalScore) * float64(classResultMpCfg.FullScore)) + float64(classInfo.ClassFullScore)) / 2))
req.ClassScoreList = append(req.ClassScoreList, &dbstruct.RavenIQTestClassScore{
ClassId: goproto.Int64(classId),
Score: goproto.Int64(score),
@ -3659,7 +3659,11 @@ func (s *Service) ApiCreateRavenIQTest(ctx *gin.Context, req *Raven_IQ_testproto
totalScoreUpperBound := list[scoreBlockIdx+1]
IQLowerBound := float64(IQResultMpcfg.Map[IQBlockId].IQLowerBound)
IQUpperBound := float64(IQResultMpcfg.Map[IQBlockId].IQUpperBound)
req.IQ = goproto.Int64(int64(math.Ceil(float64(totalScore-totalScoreLowerBound)/float64(totalScoreUpperBound-totalScoreLowerBound)*(IQUpperBound-IQLowerBound) + IQLowerBound)))
IQ := int64(math.Ceil(float64(totalScore-totalScoreLowerBound)/float64(totalScoreUpperBound-totalScoreLowerBound)*(IQUpperBound-IQLowerBound) + IQLowerBound))
if IQ == 0 {
IQ = IQResultMpcfg.Map[IQBlockId].IQLowerBound
}
req.IQ = goproto.Int64(IQ)
err = _DefaultRavenIQTest.OpCreate(ctx, &Raven_IQ_testproto.OpCreateReq{
BaseRequest: req.BaseRequest,