By Robin at 20240724

This commit is contained in:
Leufolium 2024-07-24 14:14:26 +08:00
parent 6b800705c5
commit d74af2c693
4 changed files with 13 additions and 5 deletions

View File

@ -17,6 +17,7 @@ type ApiListVO struct {
type ApiClassScoreVO struct {
ClassBlockId int64 `json:"class_block_id"` // 大类得分key
Score int64 `json:"score"` // 总分
*apollostruct.ClassInfo
*apollostruct.ClassResult
}
@ -35,7 +36,7 @@ func (vo *ApiListVO) CopyRavenIQTest(test *dbstruct.RavenIQTest) *ApiListVO {
vo.ClassScoreList = append(vo.ClassScoreList, &ApiClassScoreVO{
ClassBlockId: score.GetClassBlockId(),
Score: score.GetScore(),
ClassResult: &apollostruct.ClassResult{
ClassInfo: &apollostruct.ClassInfo{
ClassId: score.GetClassId(),
},
})

View File

@ -13,6 +13,7 @@ type RavenIQTestQuestion struct {
type IQResult struct {
IQBlockId int64 `json:"IQ_Block_Id"` // IQ分段id
IQGrade string `json:"IQ_grade"` // 智商等级
Percentile int64 `json:"percentile"` // 百分位
Description string `json:"description"` // 描述
Suggestions []string `json:"suggestions"` // 建议
@ -33,12 +34,16 @@ type IQResultMapCfg struct {
}
type ClassResult struct {
ClassId int64 `json:"class_id"` // 大类id
Description string `json:"description"` // 描述
Analysis string `json:"analysis"` // 成绩分析
Suggestions []*Suggestion `json:"suggestions"` // 建议
}
type ClassInfo struct {
ClassId int64 `json:"class_id"` // 大类id
ClassName string `json:"class_name"` // 大类名称
}
type Suggestion struct {
Title string `json:"title"`
Tips []*Tip `json:"tips"`
@ -50,5 +55,6 @@ type Tip struct {
}
type ClassResultMapCfg struct {
Map map[int64]*ClassResult `json:"map"`
Map map[int64]*ClassResult `json:"map"`
ClassInfoMap map[int64]*ClassInfo `json:"class_info_map"`
}

View File

@ -3627,7 +3627,7 @@ func (s *Service) ApiCreateRavenIQTest(ctx *gin.Context, req *Raven_IQ_testproto
return -1, errcode.ErrCodeRavenIQTestQuestionNotExist
}
if answer.GetSelectedOption() == question.CorrectOption {
classScoreMap[answer.GetQuestionId()] += 1
classScoreMap[question.ClassId] += 1
}
}
@ -3710,6 +3710,7 @@ func (s *Service) ApiGetRavenIQTestList(ctx *gin.Context, req *Raven_IQ_testprot
for _, classScore := range vo.ClassScoreList {
classScore.ClassResult = classResultMpCfg.Map[classScore.ClassBlockId]
classScore.ClassInfo = classResultMpCfg.ClassInfoMap[classScore.ClassInfo.ClassId]
}
return

View File

@ -39,7 +39,7 @@ func (p *RavenIQTest) GetUserId() int64 {
}
func (p *RavenIQTest) GetAge() int64 {
if p == nil || p.UserId == nil {
if p == nil || p.Age == nil {
return 0
}
return *p.Age