Skip to content

Commit bea09c3

Browse files
committed
feat: improve handling of 'undetermined' case; fix: bug with archive option disappearing
1 parent c085600 commit bea09c3

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

plots.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ function update_totals(dandiset_id) {
215215
const human_readable_bytes_sent = format_bytes(totals.total_bytes_sent);
216216
//totals_element.innerText = `Totals: ${human_readable_bytes_sent} sent to ?(WIP)? unique requesters from
217217
// ${totals.number_of_unique_regions} regions of ${totals.number_of_unique_countries} countries.`;
218-
totals_element.innerHTML = `A total of ${human_readable_bytes_sent} was sent to ${totals.number_of_unique_regions} regions across ${totals.number_of_unique_countries} countries. <sup>*</sup>`;
218+
header = `A total of ${human_readable_bytes_sent} was sent to ${totals.number_of_unique_regions} regions across ${totals.number_of_unique_countries} countries. <sup>*</sup>`
219+
totals_element.innerHTML = dandiset_id != "undetermined" ? header : header + `<br>However, the activity could not be uniquely associated with a particular Dandiset.<br>This can occur if the same file exists within more than one Dandiset at a time.`
219220

220221
// Add the footnote
221222
const footnote = document.createElement("div");
@@ -336,13 +337,13 @@ function load_histogram(dandiset_id) {
336337
let by_asset_summary_tsv_url, dandiset_totals_json_url;
337338

338339
// Suppress div element content if 'archive' is selected
339-
if (dandiset_id === "archive") {
340-
// const plot_element = document.getElementById(plot_element_id);
341-
// if (plot_element) {
342-
// plot_element.innerText = "";
343-
// }
344-
// return "";
345-
340+
if (dandiset_id === "undetermined") {
341+
const plot_element = document.getElementById("histogram");
342+
if (plot_element) {
343+
plot_element.innerText = "";
344+
}
345+
return "";
346+
} if (dandiset_id === "archive") {
346347
load_dandiset_histogram()
347348
} else {
348349
by_asset_summary_tsv_url = `${BASE_TSV_URL}/${dandiset_id}/by_asset.tsv`;
@@ -363,7 +364,6 @@ function load_dandiset_histogram() {
363364
.then((data) => {
364365
// Exclude 'archive' and cast IDs to strings
365366
const combined = Object.keys(data)
366-
.filter(key => key !== "archive")
367367
.map(dandiset_id => ({
368368
dandiset_id: "Dandiset ID " + String(dandiset_id),
369369
bytes: data[dandiset_id].total_bytes_sent

0 commit comments

Comments
 (0)