From f2e00505a73a39036690e9b8674f96fa4164941d Mon Sep 17 00:00:00 2001 From: frankknoll Date: Mon, 3 Apr 2023 00:15:00 +0200 Subject: [PATCH] refactoring --- docs/HistoDescrsProvider.js | 5 ++--- docs/HistogramView.js | 9 ++++----- docs/batchCodeTable.js | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/docs/HistoDescrsProvider.js b/docs/HistoDescrsProvider.js index 55fa7469014..c20aeb72206 100644 --- a/docs/HistoDescrsProvider.js +++ b/docs/HistoDescrsProvider.js @@ -1,8 +1,7 @@ class HistoDescrsProvider { - // FK-TODO: remove country - static getHistoDescrs(country, batchcode) { - return fetch(`data/histograms/${country}/${batchcode}.json`) + static getHistoDescrs(batchcode) { + return fetch(`data/histograms/Global/${batchcode}.json`) .then(response => response.json()) .then(histoDescrs => { histoDescrs.histograms.sort((histoDescr1, histoDescr2) => histoDescr1.batchcodes.length - histoDescr2.batchcodes.length); diff --git a/docs/HistogramView.js b/docs/HistogramView.js index d928df0d7fa..e854a150554 100644 --- a/docs/HistogramView.js +++ b/docs/HistogramView.js @@ -6,18 +6,17 @@ class HistogramView { this.#uiContainer = uiContainer } - // FK-TODO: remove country - displayHistogramView(country, batchcode) { + displayHistogramView(batchcode) { this - .#loadHistoDescrs(country, batchcode) + .#loadHistoDescrs(batchcode) .then(histoDescrs => this.#displayHistogramViewForHistoDescrs(histoDescrs)); } - #loadHistoDescrs(country, batchcode) { + #loadHistoDescrs(batchcode) { const loadingText = document.createTextNode('Loading...'); this.#uiContainer.appendChild(loadingText); return HistoDescrsProvider - .getHistoDescrs(country, batchcode) + .getHistoDescrs(batchcode) .then(histoDescrs => { loadingText.remove(); return histoDescrs; diff --git a/docs/batchCodeTable.js b/docs/batchCodeTable.js index 2b2547cf9e1..c46d18a9c7d 100644 --- a/docs/batchCodeTable.js +++ b/docs/batchCodeTable.js @@ -141,7 +141,7 @@ class BatchCodeTableInitializer { row.child(uiContainer).show(); tr.addClass('shown'); const batchcode = row.data()[thisClassInstance.#getColumnIndex('Batch')]; - new HistogramView(uiContainer).displayHistogramView('Global', batchcode); + new HistogramView(uiContainer).displayHistogramView(batchcode); GoogleAnalytics.click_batchcode(batchcode); } });