Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
getFacetedUniqueValues,
useReactTable,
} from "@tanstack/react-table"
import { getInstance } from "@/utils/meta-data"
import { MetaDataEntry } from "@/types/meta-data"

const InstancesTableResult = ({
Expand Down Expand Up @@ -72,10 +71,7 @@ const InstancesTableResult = ({
temporalResolution: sizeData.temporalResolution,
nOfVariables: sizeData.nOfVariables,
nOfConstraints: sizeData.nOfConstraints,
instance: getInstance(
sizeData.temporalResolution.toString(),
sizeData.spatialResolution.toString()
),
instance: sizeData.name,
})),
[benchmarkDetail.sizes.length]
)
Expand Down
7 changes: 2 additions & 5 deletions website-nextjs/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import resultActions from "@/redux/results/actions"
import filterActions from "@/redux/filters/actions"
import AdminLayout from "@/pages/AdminLayout"
import { getBenchmarkResults, getLatestBenchmarkResult } from "@/utils/results"
import { getInstance, getMetaData } from "@/utils/meta-data"
import { getMetaData } from "@/utils/meta-data"
import { BenchmarkResult } from "@/types/benchmark"
import { IFilterState } from "@/types/state"

Expand All @@ -29,10 +29,7 @@ function App({ Component, pageProps }: AppProps) {
Object.keys(metaData).forEach((metaDataKey) => {
metaData[metaDataKey].sizes.forEach((s) => {
problemSizeResult[
`${metaDataKey}'-'${getInstance(
s.temporalResolution.toString(),
s.spatialResolution.toString()
)}`
`${metaDataKey}'-'${s.name}`
] = s.size
})
})
Expand Down
12 changes: 2 additions & 10 deletions website-nextjs/src/redux/filters/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { BenchmarkResult } from "@/types/benchmark"
import { MetaData, MetaDataEntry, Size } from "@/types/meta-data"
import { getLatestBenchmarkResult } from "@/utils/results"
import { IFilterState } from "@/types/state"
import { getInstance } from "@/utils/meta-data"

const toggleFilter = (category: string, value: string, only: boolean) => {
return {
Expand Down Expand Up @@ -56,10 +55,7 @@ const actions = {
}
results.rawMetaData[metaDataKey].sizes.forEach((s: Size) => {
problemSizeResult[
`${metaDataKey}'-'${getInstance(
s.temporalResolution.toString(),
s.spatialResolution.toString()
)}`
`${metaDataKey}'-'${s.name}`
] = s.size
})
})
Expand All @@ -68,12 +64,8 @@ const actions = {
results.rawBenchmarkResults.filter((benchmark: BenchmarkResult) =>
(metaData[benchmark.benchmark] as MetaDataEntry)?.sizes?.find(
(size) => {
const temporalResolution =
size.temporalResolution === "NA"
? size.temporalResolution
: `${size.temporalResolution}h`
return (
`${size.spatialResolution}-${temporalResolution}` ===
size.name ===
benchmark.size &&
filters.problemSize.includes(
problemSizeResult[
Expand Down
1 change: 1 addition & 0 deletions website-nextjs/src/types/meta-data.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

type Size = {
name: string
spatialResolution: number
temporalResolution: number | string
nOfConstraints: number
Expand Down
8 changes: 1 addition & 7 deletions website-nextjs/src/utils/meta-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,8 @@ const getMetaData = async () => {
return toCamelCase(rawData) as MetaData
}

const getInstance = (temporalResolution: string, spatialResolution: string) => {
const tempResolution =
temporalResolution === "NA" ? temporalResolution : `${temporalResolution}h`
return `${spatialResolution}-${tempResolution}`
}

const getUniqueValues = <T, K extends keyof T>(data: T[], key: K): T[K][] =>
Array.from(new Set(data.map(item => item[key])));


export { getMetaData, getInstance, getUniqueValues }
export { getMetaData, getUniqueValues }
Loading