generated from VLADIMIR/template
fix
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user