This commit is contained in:
2026-09-02 23:35:15 +07:00
parent 38d2227f99
commit daba1c244d
12 changed files with 1208 additions and 276 deletions
+38
View File
@@ -0,0 +1,38 @@
package app
import (
"evening_detective_server/internal/modules/storytelling"
"evening_detective_server/internal/services/game_service"
proto "evening_detective_server/proto"
)
// mapResultsQuestions мапит вопросы сценария в шапку итоговой таблицы:
// правильный ответ (поле Answer) не передаётся — он виден только в панели
// оценки (GetGameAnswers).
func mapResultsQuestions(o []*storytelling.Question) []*proto.ResultsQuestion {
res := make([]*proto.ResultsQuestion, 0, len(o))
for _, item := range o {
res = append(res, &proto.ResultsQuestion{
Code: item.Code,
Text: item.Text,
})
}
return res
}
// mapTeamResults мапит строки итоговой таблицы. Команда мапится целиком
// (включая password/applications — аудитория та же, что у GetGameAnswers:
// организатор/автор); actionsCount продублирован на уровне строки таблицы.
func mapTeamResults(o []game_service.TeamResult) []*proto.TeamResult {
res := make([]*proto.TeamResult, 0, len(o))
for _, item := range o {
res = append(res, &proto.TeamResult{
Team: mapTeam(item.Team),
Answers: mapAnswerScores(item.Answers),
TotalScore: int32(item.TotalScore),
Place: int32(item.Place),
ActionsCount: int32(item.Team.ActionsCount),
})
}
return res
}