replace space from title and field name always
This commit is contained in:
parent
09a4271a9a
commit
35e57bdb80
@ -59,11 +59,12 @@ func ToCreatedUpdateQuestionRules(questionsTypeMap map[model.EntityType][]model.
|
|||||||
// если заголоввок пустой у вопроса делаем ему заголовок чтоб в амо легли филды нормально
|
// если заголоввок пустой у вопроса делаем ему заголовок чтоб в амо легли филды нормально
|
||||||
title := strings.ReplaceAll(question.Title, " ", "")
|
title := strings.ReplaceAll(question.Title, " ", "")
|
||||||
if title == "" {
|
if title == "" {
|
||||||
question.Title = fmt.Sprintf("Вопрос №%d", question.Page)
|
title = fmt.Sprintf("Вопрос №%d", question.Page)
|
||||||
}
|
}
|
||||||
matched := false
|
matched := false
|
||||||
for _, field := range currentFields {
|
for _, field := range currentFields {
|
||||||
if question.Title == field.Name && entity == field.Entity {
|
fieldName := strings.ReplaceAll(field.Name, " ", "")
|
||||||
|
if title == fieldName && entity == field.Entity {
|
||||||
toUpdate[int(question.Id)] = ToUpdate{
|
toUpdate[int(question.Id)] = ToUpdate{
|
||||||
FieldID: int(field.Amoid),
|
FieldID: int(field.Amoid),
|
||||||
Entity: entity,
|
Entity: entity,
|
||||||
|
@ -684,7 +684,8 @@ func (m *Methods) CheckFieldRule(ctx context.Context, token string, msg models.K
|
|||||||
question.Title = fmt.Sprintf("Вопрос №%d", question.Page)
|
question.Title = fmt.Sprintf("Вопрос №%d", question.Page)
|
||||||
}
|
}
|
||||||
for _, field := range newFields {
|
for _, field := range newFields {
|
||||||
if question.Title == field.Name && field.Entity == currentEntity {
|
fieldName := strings.ReplaceAll(field.Name, " ", "")
|
||||||
|
if title == fieldName && field.Entity == currentEntity {
|
||||||
ruleMap := make(map[int]int)
|
ruleMap := make(map[int]int)
|
||||||
ruleMap[questionID] = int(field.Amoid)
|
ruleMap[questionID] = int(field.Amoid)
|
||||||
*fieldRule = append(*fieldRule, model.FieldRule{Questionid: ruleMap})
|
*fieldRule = append(*fieldRule, model.FieldRule{Questionid: ruleMap})
|
||||||
|
Loading…
Reference in New Issue
Block a user