Skip to content

Commit 8592110

Browse files
committed
[service] prepend form name to all event form fields for clarity and to avoid ESRI column name conflicts
1 parent 07986a6 commit 8592110

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

plugins/arcgis/service/src/FeatureServiceAdmin.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -352,16 +352,13 @@ export class FeatureServiceAdmin {
352352
* @param fieldNames set of all field names
353353
*/
354354
private createFormField(form: Form, formField: FormField, fields: Field[], fieldNames: Set<string>) {
355-
356355
const field = this.initField(formField.type)
357356

358357
if (field != null) {
359-
360-
let name = ObservationsTransformer.replaceSpaces(formField.title)
361-
362-
if (fieldNames.has(name)) {
363-
name = form.name + '_' + name
364-
}
358+
const sanitizedName = ObservationsTransformer.replaceSpaces(formField.title)
359+
const sanitizedFormName = ObservationsTransformer.replaceSpaces(form.name)
360+
const name = `${sanitizedFormName}_${sanitizedName}`
361+
365362
fieldNames.add(name)
366363

367364
field.name = name
@@ -372,7 +369,6 @@ export class FeatureServiceAdmin {
372369

373370
fields.push(field)
374371
}
375-
376372
}
377373

378374
/**

0 commit comments

Comments
 (0)