正在显示
1 个修改的文件
包含
10 行增加
和
7 行删除
@@ -55,8 +55,8 @@ func buildChanceCheckResultData(checkResultData []models.ChanceCheckResult) (pro | @@ -55,8 +55,8 @@ func buildChanceCheckResultData(checkResultData []models.ChanceCheckResult) (pro | ||
55 | checkResultMap := map[int64]*protocol.ChanceCheckResultData{} | 55 | checkResultMap := map[int64]*protocol.ChanceCheckResultData{} |
56 | checkReusltSlice := []*protocol.ChanceCheckResultData{} | 56 | checkReusltSlice := []*protocol.ChanceCheckResultData{} |
57 | //按人区分问题的答案 | 57 | //按人区分问题的答案 |
58 | - userAnswer := make(map[int64]map[int64]string) | ||
59 | - for _, resultData := range checkResultData { | 58 | + userAnswer := make(map[int64]map[int64]models.ChanceCheckResult) |
59 | + for i, resultData := range checkResultData { | ||
60 | if _, ok := checkResultMap[resultData.CheckId]; !ok { | 60 | if _, ok := checkResultMap[resultData.CheckId]; !ok { |
61 | r := &protocol.ChanceCheckResultData{ | 61 | r := &protocol.ChanceCheckResultData{ |
62 | CheckId: resultData.CheckId, | 62 | CheckId: resultData.CheckId, |
@@ -68,10 +68,10 @@ func buildChanceCheckResultData(checkResultData []models.ChanceCheckResult) (pro | @@ -68,10 +68,10 @@ func buildChanceCheckResultData(checkResultData []models.ChanceCheckResult) (pro | ||
68 | } | 68 | } |
69 | userIds.Add(resultData.UserCompanyId) | 69 | userIds.Add(resultData.UserCompanyId) |
70 | if _, ok := userAnswer[resultData.UserCompanyId]; ok { | 70 | if _, ok := userAnswer[resultData.UserCompanyId]; ok { |
71 | - userAnswer[resultData.UserCompanyId][resultData.CheckId] = resultData.Answer | 71 | + userAnswer[resultData.UserCompanyId][resultData.CheckId] = checkResultData[i] |
72 | } else { | 72 | } else { |
73 | - userAnswer[resultData.UserCompanyId] = map[int64]string{ | ||
74 | - resultData.CheckId: resultData.Answer, | 73 | + userAnswer[resultData.UserCompanyId] = map[int64]models.ChanceCheckResult{ |
74 | + resultData.CheckId: checkResultData[i], | ||
75 | } | 75 | } |
76 | } | 76 | } |
77 | } | 77 | } |
@@ -91,15 +91,18 @@ func buildChanceCheckResultData(checkResultData []models.ChanceCheckResult) (pro | @@ -91,15 +91,18 @@ func buildChanceCheckResultData(checkResultData []models.ChanceCheckResult) (pro | ||
91 | customItemsData := map[string]string{} | 91 | customItemsData := map[string]string{} |
92 | for uid := range userAnswer { | 92 | for uid := range userAnswer { |
93 | if answer, ok := userAnswer[uid][checkReusltSlice[i].CheckId]; ok { | 93 | if answer, ok := userAnswer[uid][checkReusltSlice[i].CheckId]; ok { |
94 | - switch answer { | 94 | + switch answer.Answer { |
95 | case "是": | 95 | case "是": |
96 | checkReusltSlice[i].AnswerYes++ | 96 | checkReusltSlice[i].AnswerYes++ |
97 | + customItemsData[usernameMap[uid]] = answer.Answer | ||
97 | case "否": | 98 | case "否": |
98 | checkReusltSlice[i].AnswerNo++ | 99 | checkReusltSlice[i].AnswerNo++ |
100 | + customItemsData[usernameMap[uid]] = fmt.Sprintf("%s,理由:%s", answer.Answer, answer.Reason) | ||
99 | case "不清楚": | 101 | case "不清楚": |
100 | checkReusltSlice[i].AnswerAny++ | 102 | checkReusltSlice[i].AnswerAny++ |
103 | + customItemsData[usernameMap[uid]] = answer.Answer | ||
101 | } | 104 | } |
102 | - customItemsData[usernameMap[uid]] = answer | 105 | + |
103 | } else { | 106 | } else { |
104 | customItemsData[usernameMap[uid]] = "" | 107 | customItemsData[usernameMap[uid]] = "" |
105 | } | 108 | } |
-
请 注册 或 登录 后发表评论