Skip to content

Commit

Permalink
fix substr
Browse files Browse the repository at this point in the history
  • Loading branch information
zbycz committed Oct 30, 2023
1 parent a2c280f commit eced6f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/services/tagging/idTaggingScheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ const matchRestToFields = (keysTodo: KeysTodo, feature: Feature): UiField[] =>
const field =
matchingFields.find((f) => f.fieldKey === key) ?? matchingFields?.[0];

const includeThisField = field;

if (!includeThisField) {
if (!field) {
return undefined;
}
return getUiField(field, keysTodo, feature, key);
Expand Down Expand Up @@ -163,8 +161,8 @@ const getFeaturedTags = (feature: Feature) => {
'contact:mobile',
'opening_hours',
...(tags.wikipedia ? ['wikipedia'] : tags.wikidata ? ['wikidata'] : []),
'description',
'fhrs:id',
'description',
];

return keys.reduce(
Expand All @@ -177,7 +175,7 @@ export const getSchemaForFeature = (feature: Feature) => {
const preset = getPresetForFeature(feature);

keysTodo.init(feature);
keysTodo.resolveTags(preset.tags); // remove tags which are already covered by Preset keys
keysTodo.resolveTags(preset.tags); // remove tags which are already covered by Preset
keysTodo.remove('name'); // always rendered by FeaturePanel

const featuredTags = feature.deleted ? [] : getFeaturedTags(feature);
Expand Down
2 changes: 1 addition & 1 deletion src/services/tagging/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const getFieldTranslation = (field: Field): FieldTranslation => {
if (!translations) return undefined;

if (field.label?.match(/^{.*}$/)) {
const resolved = field.label.substring(1, field.label.length - 2);
const resolved = field.label.substring(1, field.label.length - 1);
return translations[intl.lang].presets.fields[resolved];
}

Expand Down

0 comments on commit eced6f5

Please sign in to comment.