Skip to content

Commit

Permalink
🔨 incorporate PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
danyx23 committed Feb 1, 2025
1 parent c1d8bfd commit 9e19d0d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/@ourworldindata/grapher/src/core/LegacyToOwidTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
EntityId,

Check warning on line 11 in packages/@ourworldindata/grapher/src/core/LegacyToOwidTable.ts

View workflow job for this annotation

GitHub Actions / eslint

'EntityId' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 11 in packages/@ourworldindata/grapher/src/core/LegacyToOwidTable.ts

View workflow job for this annotation

GitHub Actions / eslint

'EntityId' is defined but never used. Allowed unused vars must match /^_/u
ErrorValue,
OwidChartDimensionInterfaceWithMandatorySlug,
EntityName,
} from "@ourworldindata/types"
import {
OwidTable,
Expand Down Expand Up @@ -332,20 +333,19 @@ export const legacyToOwidTableAndDimensions = (
const entityColorColumnSlug = OwidTableSlugs.entityColor

const valueFn = (
entityId: EntityId | undefined
entityName: EntityName | undefined
): string | ErrorValue => {
if (!entityId) return ErrorValueTypes.UndefinedButShouldBeString
const entityName =
joinedVariablesTable.entityIdToNameMap.get(entityId)
if (!entityName) return ErrorValueTypes.UndefinedButShouldBeString
return entityName && selectedEntityColors
? (selectedEntityColors[entityName] ??
ErrorValueTypes.UndefinedButShouldBeString)
: ErrorValueTypes.UndefinedButShouldBeString
}

const values = joinedVariablesTable.rows.map((row) =>
valueFn(row.entityId)
)
const values =
joinedVariablesTable.entityNameColumn.valuesIncludingErrorValues.map(
(entityName) => valueFn(entityName as EntityName)
)

joinedVariablesTable = joinedVariablesTable.appendColumns([
{
Expand Down

0 comments on commit 9e19d0d

Please sign in to comment.