Skip to content

Commit

Permalink
fix(api): use country from city locode in geographicalLocation source…
Browse files Browse the repository at this point in the history
… matching
  • Loading branch information
lemilonkh committed Mar 29, 2024
1 parent 9b20142 commit bbdc3e2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/src/backend/DataSourceService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export default class DataSourceService {
return true;
}

const isCountry = city.country && locations?.includes(city.country);
// TODO store locode for country and region as separate columns in City
const countryLocode = city.locode?.split(" ")[0];
const isCountry = countryLocode && locations?.includes(countryLocode);
const isRegion = city.region && locations?.includes(city.region);
const isCity = city.locode && locations?.includes(city.locode);

Expand Down Expand Up @@ -108,7 +110,9 @@ export default class DataSourceService {
});

if (!subCategory) {
throw new createHttpError.InternalServerError("Sub-category for source not found");
throw new createHttpError.InternalServerError(
"Sub-category for source not found",
);
}

// TODO what to do with existing InventoryValues and GasValues?
Expand Down

0 comments on commit bbdc3e2

Please sign in to comment.