generated from VLADIMIR/template
33 lines
862 B
Go
33 lines
862 B
Go
package app
|
|
|
|
import (
|
|
"evening_detective_server/internal/modules/storytelling"
|
|
"evening_detective_server/internal/services/answer_service"
|
|
proto "evening_detective_server/proto"
|
|
)
|
|
|
|
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
|
|
}
|
|
|
|
func mapTeamResults(o []answer_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
|
|
}
|