Skip to content

Commit

Permalink
fix(ui-tablemode): 'co2' column not working
Browse files Browse the repository at this point in the history
  • Loading branch information
skamril committed Feb 27, 2024
1 parent a351458 commit 325f542
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions webapp/src/services/api/studies/tableMode/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { snakeCase } from "lodash";
import { DeepPartial } from "react-hook-form";
import { StudyMetadata } from "../../../../common/types";
import client from "../../client";
import { format } from "../../../../utils/stringUtils";
import { TABLE_MODE_API_URL } from "../../constants";
import type { TableData, TableModeColumnsForType, TableModeType } from "./type";
import { toColumnApiName } from "./utils";

export async function getTableMode<T extends TableModeType>(
studyId: StudyMetadata["id"],
Expand All @@ -15,7 +15,7 @@ export async function getTableMode<T extends TableModeType>(
const res = await client.get(url, {
params: {
table_type: type,
columns: columns.map(snakeCase).join(","),
columns: columns.map(toColumnApiName).join(","),
},
});
return res.data;
Expand Down
11 changes: 11 additions & 0 deletions webapp/src/services/api/studies/tableMode/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { snakeCase } from "lodash";
import { TableModeColumnsForType, TableModeType } from "./type";

export function toColumnApiName(
column: TableModeColumnsForType<TableModeType>[number],
) {
if (column === "co2") {
return "co2";
}
return snakeCase(column);
}

0 comments on commit 325f542

Please sign in to comment.