This commit is contained in:
parent
2ea3ebb6aa
commit
bb2c18fa4b
|
@ -44,7 +44,6 @@ 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"` // 大类满分
|
||||
}
|
||||
|
||||
|
@ -62,4 +61,5 @@ type ClassResultMapCfg struct {
|
|||
Map map[int64]*ClassResult `json:"map"`
|
||||
ClassInfoMap map[int64]*ClassInfo `json:"class_info_map"`
|
||||
FullScore int64 `json:"full_score"` // 满分
|
||||
TotalScore int64 `json:"total_score"` // 总分
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue