generated from VLADIMIR/template
fix codes
This commit is contained in:
@@ -171,8 +171,7 @@ func (s *ScenarioService) getStory(ctx context.Context, id int) (*storytelling.S
|
||||
func (s *ScenarioService) updateStory(ctx context.Context, id int, story *storytelling.Story) error {
|
||||
mapCodes := map[string]struct{}{}
|
||||
for _, place := range story.Places {
|
||||
code := s.cleaner.ClearCode(place.Code)
|
||||
mapCodes[code] = struct{}{}
|
||||
mapCodes[place.Code] = struct{}{}
|
||||
place.Image = strings.TrimPrefix(place.Image, s.domain)
|
||||
}
|
||||
if len(mapCodes) != len(story.Places) {
|
||||
@@ -181,11 +180,9 @@ func (s *ScenarioService) updateStory(ctx context.Context, id int, story *storyt
|
||||
|
||||
cleanPlaces := make([]*storytelling.Place, 0, len(story.Places))
|
||||
for _, place := range story.Places {
|
||||
code := s.cleaner.ClearCode(place.Code)
|
||||
if code == "" {
|
||||
if place.Code == "" {
|
||||
continue
|
||||
}
|
||||
place.Code = code
|
||||
cleanPlaces = append(cleanPlaces, place)
|
||||
}
|
||||
story.Places = cleanPlaces
|
||||
|
||||
Reference in New Issue
Block a user