Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(download): include Year column for explorers when its slug isn't "year" #4445

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion packages/@ourworldindata/core-table/src/OwidTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -701,9 +701,19 @@ export class OwidTable extends CoreTable<OwidRow, OwidColumnDef> {
): string {
let table
if (activeColumnSlugs?.length) {
table = this.select([
const timeColumnToInclude = [
OwidTableSlugs.year,
OwidTableSlugs.day,
this.timeColumn.slug, // needed for explorers, where the time column may be called anything
].find((colSlug) => this.has(colSlug))

if (!timeColumnToInclude)
throw new Error(
"Expected to find a time column to include in the CSV"
)

table = this.select([
timeColumnToInclude,
this.entityNameSlug,
...activeColumnSlugs,
])
Expand Down
Loading