generated from VLADIMIR/template
39 lines
1.4 KiB
Go
39 lines
1.4 KiB
Go
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
|
|
}
|