generated from VLADIMIR/template
add application number
This commit is contained in:
@@ -95,8 +95,21 @@ func (s *StoryService) GetPlaces(codes []string) []*models.Place {
|
||||
places := make([]*models.Place, 0, 100)
|
||||
mOpen := map[string]any{}
|
||||
mDeleted := map[string]any{}
|
||||
applicationNumber := 1
|
||||
applicationsMap := make(map[string]interface{}, 10)
|
||||
for i, code := range codes {
|
||||
place := s.GetPlace(code)
|
||||
for i, application := range place.Applications {
|
||||
if _, ok := applicationsMap[application.Name]; ok {
|
||||
place.Applications = append(place.Applications[:i], place.Applications[i+1:]...)
|
||||
if len(place.Applications) == 0 {
|
||||
place.Applications = nil
|
||||
}
|
||||
}
|
||||
applicationsMap[application.Name] = struct{}{}
|
||||
application.SetNumber(applicationNumber)
|
||||
applicationNumber++
|
||||
}
|
||||
if _, ok := mOpen[place.Code]; place.Hidden && !ok {
|
||||
place = models.NewNotFoundPlace(place.Code)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user