generated from VLADIMIR/template
fix
This commit is contained in:
@@ -609,14 +609,14 @@ func (s *ScenarioService) updateStory(ctx context.Context, id int, story *storyt
|
||||
// Общая для редактирования и импорта.
|
||||
func normalizeStory(story *storytelling.Story) (string, error) {
|
||||
if story.Conclusion != nil && story.Conclusion.Video != "" && file_storage.FileType(story.Conclusion.Video) != "video" {
|
||||
return "", errors.New("Видео закрывашки должно быть в формате MP4 или WebM")
|
||||
return "", errors.New("видео закрывашки должно быть в формате MP4 или WebM")
|
||||
}
|
||||
codes := map[string]struct{}{}
|
||||
for _, place := range story.Places {
|
||||
codes[place.Code] = struct{}{}
|
||||
}
|
||||
if len(codes) != len(story.Places) {
|
||||
return "", errors.New("Такой код точки уже существует")
|
||||
return "", errors.New("такой код точки уже существует")
|
||||
}
|
||||
|
||||
cleanPlaces := make([]*storytelling.Place, 0, len(story.Places))
|
||||
@@ -640,7 +640,7 @@ func normalizeStory(story *storytelling.Story) (string, error) {
|
||||
questionCodes[question.Code] = struct{}{}
|
||||
}
|
||||
if len(questionCodes) != len(story.Questions) {
|
||||
return "", errors.New("Такой код вопроса уже существует")
|
||||
return "", errors.New("такой код вопроса уже существует")
|
||||
}
|
||||
cleanQuestions := make([]*storytelling.Question, 0, len(story.Questions))
|
||||
for _, question := range story.Questions {
|
||||
|
||||
@@ -883,7 +883,7 @@ func TestNormalizeStoryQuestionCodes(t *testing.T) {
|
||||
t.Fatalf("AddScenarioQuestion q1: %v", err)
|
||||
}
|
||||
err = svc.AddScenarioQuestion(context.Background(), 1, &storytelling.Question{Code: "q1"}, 7, false)
|
||||
if err == nil || !strings.Contains(err.Error(), "Такой код вопроса уже существует") {
|
||||
if err == nil || !strings.Contains(err.Error(), "такой код вопроса уже существует") {
|
||||
t.Errorf("AddScenarioQuestion с дублем кода: err = %v, want ошибку о дубле", err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user