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 @@ -55,17 +55,9 @@ function App() {
const toggleSettings = () => setIsSettingsOpen(!isSettingsOpen);
const closeSettings = () => setIsSettingsOpen(false);

const downloadDataset = () => {
// check if dataset has a default property that duplicates the content
const containsDefault = 'default' in dataset &&
typeof dataset.default === 'object' &&
dataset.default !== null &&
'scenarioRunResults' in (dataset.default as any);

const dataToSerialize = containsDefault ? dataset.default : dataset;

const downloadDataset = () => {
// create a stringified JSON of the dataset
const dataStr = JSON.stringify(dataToSerialize, null, 2);
const dataStr = JSON.stringify(dataset, null, 2);

// create a link to download the JSON file in the page and click it
const blob = new Blob([dataStr], { type: 'application/json' });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ let dataset: Dataset = { scenarioRunResults: [] };
if (!import.meta.env.PROD) {
// This only runs in development. In production the data is embedded into the dataset variable declaration above.
// run `node init-devdata.js` to populate the data file from the most recent execution.
dataset = await import("../devdata.json") as unknown as Dataset;
const imported = await import("../devdata.json");
dataset = imported.default as unknown as Dataset;
}

const scoreSummary = createScoreSummary(dataset);
Expand Down
Loading