From 630a2879faa132f3b5cdd9c8606cb3a8709b944e Mon Sep 17 00:00:00 2001
From: frankknoll
Date: Sat, 15 Apr 2023 22:26:42 +0200
Subject: [PATCH] refactoring
---
docs/BatchCodeDetailsView.js | 6 +++---
docs/BatchcodeCombinationSelection.js | 5 +++--
docs/batchCodeTable.html | 1 +
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/docs/BatchCodeDetailsView.js b/docs/BatchCodeDetailsView.js
index 068db1d9a39..a77e3951098 100644
--- a/docs/BatchCodeDetailsView.js
+++ b/docs/BatchCodeDetailsView.js
@@ -1,12 +1,14 @@
class BatchCodeDetailsView {
#uiContainer;
+ #headingElement;
#adverseReactionReportsChartView;
#histogramChartView;
#chartWithSlider;
constructor(uiContainer) {
this.#uiContainer = uiContainer
+ this.#headingElement = this.#uiContainer.querySelector(".heading");
this.#adverseReactionReportsChartView = new AdverseReactionReportsChartView(this.#uiContainer.querySelector('#adverseReactionReportsChartView'));
this.#chartWithSlider = this.#uiContainer.querySelector('.chartWithSlider');
this.#histogramChartView = new HistogramChartView(this.#chartWithSlider.querySelector("canvas"));
@@ -39,9 +41,7 @@ class BatchCodeDetailsView {
}
#displayHeading(batchcode) {
- const h1 = document.createElement("h3");
- h1.appendChild(document.createTextNode(`Frequencies of reported Symptoms for Batch Code Combinations containing ${batchcode}`));
- this.#uiContainer.appendChild(h1);
+ this.#headingElement.textContent = `Frequencies of reported Symptoms for Batch Code Combinations containing ${batchcode}`
}
#displayAdverseReactionReportsChart(histoDescrs) {
diff --git a/docs/BatchcodeCombinationSelection.js b/docs/BatchcodeCombinationSelection.js
index 7619f42c7bd..ccd60aca310 100644
--- a/docs/BatchcodeCombinationSelection.js
+++ b/docs/BatchcodeCombinationSelection.js
@@ -2,7 +2,7 @@ class BatchcodeCombinationSelection {
static configureSelectBatchcodeCombinationElement({ selectBatchcodeCombinationElement, histograms, onSelect }) {
const batchcodesSelect = selectBatchcodeCombinationElement.querySelector('#batchcodesSelect');
- this.#addBatchcodeCombinationOptions(batchcodesSelect, histograms);
+ this.#setBatchcodeCombinationOptions(batchcodesSelect, histograms);
batchcodesSelect.addEventListener(
'change',
event => {
@@ -12,7 +12,8 @@ class BatchcodeCombinationSelection {
onSelect(histograms[0]);
}
- static #addBatchcodeCombinationOptions(batchcodesSelect, histograms) {
+ static #setBatchcodeCombinationOptions(batchcodesSelect, histograms) {
+ UIUtils.clear(batchcodesSelect);
this.#getBatchcodeCombinationOptions(histograms).forEach(option => batchcodesSelect.add(option));
}
diff --git a/docs/batchCodeTable.html b/docs/batchCodeTable.html
index d6833035c32..a277ad0cdc7 100644
--- a/docs/batchCodeTable.html
+++ b/docs/batchCodeTable.html
@@ -49763,6 +49763,7 @@
+