refactoring
This commit is contained in:
@@ -1,8 +1,7 @@
|
|||||||
class HistoDescrsProvider {
|
class HistoDescrsProvider {
|
||||||
|
|
||||||
// FK-TODO: remove country
|
static getHistoDescrs(batchcode) {
|
||||||
static getHistoDescrs(country, batchcode) {
|
return fetch(`data/histograms/Global/${batchcode}.json`)
|
||||||
return fetch(`data/histograms/${country}/${batchcode}.json`)
|
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(histoDescrs => {
|
.then(histoDescrs => {
|
||||||
histoDescrs.histograms.sort((histoDescr1, histoDescr2) => histoDescr1.batchcodes.length - histoDescr2.batchcodes.length);
|
histoDescrs.histograms.sort((histoDescr1, histoDescr2) => histoDescr1.batchcodes.length - histoDescr2.batchcodes.length);
|
||||||
|
|||||||
@@ -6,18 +6,17 @@ class HistogramView {
|
|||||||
this.#uiContainer = uiContainer
|
this.#uiContainer = uiContainer
|
||||||
}
|
}
|
||||||
|
|
||||||
// FK-TODO: remove country
|
displayHistogramView(batchcode) {
|
||||||
displayHistogramView(country, batchcode) {
|
|
||||||
this
|
this
|
||||||
.#loadHistoDescrs(country, batchcode)
|
.#loadHistoDescrs(batchcode)
|
||||||
.then(histoDescrs => this.#displayHistogramViewForHistoDescrs(histoDescrs));
|
.then(histoDescrs => this.#displayHistogramViewForHistoDescrs(histoDescrs));
|
||||||
}
|
}
|
||||||
|
|
||||||
#loadHistoDescrs(country, batchcode) {
|
#loadHistoDescrs(batchcode) {
|
||||||
const loadingText = document.createTextNode('Loading...');
|
const loadingText = document.createTextNode('Loading...');
|
||||||
this.#uiContainer.appendChild(loadingText);
|
this.#uiContainer.appendChild(loadingText);
|
||||||
return HistoDescrsProvider
|
return HistoDescrsProvider
|
||||||
.getHistoDescrs(country, batchcode)
|
.getHistoDescrs(batchcode)
|
||||||
.then(histoDescrs => {
|
.then(histoDescrs => {
|
||||||
loadingText.remove();
|
loadingText.remove();
|
||||||
return histoDescrs;
|
return histoDescrs;
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ class BatchCodeTableInitializer {
|
|||||||
row.child(uiContainer).show();
|
row.child(uiContainer).show();
|
||||||
tr.addClass('shown');
|
tr.addClass('shown');
|
||||||
const batchcode = row.data()[thisClassInstance.#getColumnIndex('Batch')];
|
const batchcode = row.data()[thisClassInstance.#getColumnIndex('Batch')];
|
||||||
new HistogramView(uiContainer).displayHistogramView('Global', batchcode);
|
new HistogramView(uiContainer).displayHistogramView(batchcode);
|
||||||
GoogleAnalytics.click_batchcode(batchcode);
|
GoogleAnalytics.click_batchcode(batchcode);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user