feat: improve locatore formatting by trimming spaces and replacing multiple spaces with a single space

This commit is contained in:
Marco Pedone 2026-04-21 11:49:45 +02:00
parent e46af92bb3
commit 53ba53e3cc

View file

@ -416,7 +416,10 @@ func processLocatore(tmp *typesdefs.AnnuncioParsed, annuncio *typesdefs.Annuncio
}
tmp.Numero = &number
if trg.Cognome != nil && trg.Nome != nil {
tmp.Locatore = strUpd(fmt.Sprintf("%s %s", utils.MakeUppercase(*trg.Cognome), utils.MakeUppercase(*trg.Nome)))
rawLoc := fmt.Sprintf("%s %s", utils.MakeUppercase(*trg.Cognome), utils.MakeUppercase(*trg.Nome))
rawLoc = strings.TrimSpace(rawLoc)
rawLoc = regexp.MustCompile(`\s+`).ReplaceAllString(rawLoc, " ") // Replace multiple spaces with a single space
tmp.Locatore = strUpd(rawLoc)
}
tmp.Idlocatore = trg.Id
tmp.Tipo_locatore = strUpd(flatClienteTipologia(trg.Tipologie))