fix(falukant): map house types to matching models
All checks were successful
Deploy to production / deploy (push) Successful in 1m50s
All checks were successful
Deploy to production / deploy (push) Successful in 1m50s
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const HOUSE_MODELS = Object.freeze({
|
||||
const LEGACY_HOUSE_MODELS = Object.freeze({
|
||||
'Unter der Brücke': 'under_bridge',
|
||||
'Strohhütte': 'straw_hut',
|
||||
Holzhaus: 'wooden_house',
|
||||
@@ -10,6 +10,11 @@ const HOUSE_MODELS = Object.freeze({
|
||||
Schloss: 'castle',
|
||||
});
|
||||
|
||||
const MODEL_NAMES = new Set(Object.values(LEGACY_HOUSE_MODELS));
|
||||
|
||||
export function getFalukantHouseModel(houseType) {
|
||||
return HOUSE_MODELS[houseType?.labelTr] || 'under_bridge';
|
||||
// HouseType.labelTr is the stable database key (e.g. "wooden_house"),
|
||||
// while older data may still contain the German display label.
|
||||
const key = houseType?.abbr || houseType?.labelTr;
|
||||
return MODEL_NAMES.has(key) ? key : (LEGACY_HOUSE_MODELS[key] || 'under_bridge');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user