This commit is contained in:
2026-03-07 07:50:24 +07:00
parent 795edad998
commit 83868cc778
7 changed files with 222 additions and 7 deletions
+24 -3
View File
@@ -133,10 +133,10 @@ func (s *Services) GetTeam(ctx context.Context, req *proto.GetTeamReq) (*proto.G
if err != nil {
return nil, status.Errorf(codes.Internal, err.Error())
}
res := make([]*proto.Action, 0, len(actions))
for _, action := range actions {
newAction := mapActionToProtoAction(action)
place := s.storyService.GetPlace(action.Place)
for _, place := range s.getPlaces(actions) {
newAction := mapPlaceToProtoAction(place)
newAction.Text = place.Text
newAction.Name = place.Name
newAction.Applications = make([]*proto.Application, 0, len(place.Applications))
@@ -151,6 +151,27 @@ func (s *Services) GetTeam(ctx context.Context, req *proto.GetTeamReq) (*proto.G
}, err
}
func (s *Services) getPlaces(actions []*models.Action) []*story_service.Place {
places := []*story_service.Place{}
m := map[string]any{}
for _, action := range actions {
place := s.storyService.GetPlace(action.Place)
_, ok := m[place.Code]
if place.Hidden && !ok {
place = &story_service.Place{
Code: place.Code,
Name: "Не найдено",
Text: "Такой точки не существует.",
}
}
places = append(places, place)
for _, door := range place.Doors {
m[door.Code] = struct{}{}
}
}
return places
}
func (s *Services) GetTeamsCSV(ctx context.Context, req *proto.GetTeamsCSVReq) (*proto.GetTeamsCSVRsp, error) {
panic("unimplemented")
}