refactoring
This commit is contained in:
@@ -32,8 +32,6 @@
|
||||
<script src="./js/PageInitializer.js"></script>
|
||||
<script src="./js/PrrByVaccineProvider.js"></script>
|
||||
<script src="./js/PrrByKeyTable.js"></script>
|
||||
<script src="./js/PrrByVaccineTable.js"></script>
|
||||
<script src="./js/PrrBySymptomTable.js"></script>
|
||||
<script src="./js/PrrByKeyTableView.js"></script>
|
||||
<script src="./js/PrrByVaccineTableView.js"></script>
|
||||
<script src="./js/PrrBySymptomTableView.js"></script>
|
||||
|
||||
@@ -54,14 +54,16 @@ class PrrByKeyTable {
|
||||
targets: [this.#getColumnIndex(this.#prrColumnName)]
|
||||
},
|
||||
{
|
||||
render: prr =>
|
||||
NumberWithBarElementFactory
|
||||
.createNumberWithBarElement(
|
||||
{
|
||||
number: prr,
|
||||
barLenInPercent: prr / this.#sumPrrs * 100
|
||||
})
|
||||
.outerHTML,
|
||||
render: (prr, type, row, meta) =>
|
||||
(type === 'sort' || type === 'type') ?
|
||||
parseFloat(prr) :
|
||||
NumberWithBarElementFactory
|
||||
.createNumberWithBarElement(
|
||||
{
|
||||
number: prr,
|
||||
barLenInPercent: prr / this.#sumPrrs * 100
|
||||
})
|
||||
.outerHTML,
|
||||
targets: [this.#getColumnIndex(this.#prrColumnName)]
|
||||
}
|
||||
],
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
class PrrBySymptomTable {
|
||||
|
||||
#delegate;
|
||||
|
||||
constructor(tableElement) {
|
||||
this.#delegate = new PrrByKeyTable({
|
||||
tableElement: tableElement,
|
||||
keyColumnName: 'Symptom',
|
||||
prrColumnName: 'Proportional Reporting Ratio > 1',
|
||||
shallMarkRowIfPrrTooHigh: false
|
||||
});
|
||||
}
|
||||
|
||||
initialize() {
|
||||
this.#delegate.initialize();
|
||||
}
|
||||
|
||||
display(prrBySymptom) {
|
||||
this.#delegate.display(prrBySymptom);
|
||||
}
|
||||
|
||||
getDisplayedTableAsCsv(heading) {
|
||||
return this.#delegate.getDisplayedTableAsCsv(heading);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ class PrrBySymptomTableView {
|
||||
|
||||
constructor(prrBySymptomTableElement, downloadPrrBySymptomTableButton) {
|
||||
this.#delegate = new PrrByKeyTableView(
|
||||
new PrrBySymptomTable(prrBySymptomTableElement),
|
||||
this.#createPrrBySymptomTable(prrBySymptomTableElement),
|
||||
downloadPrrBySymptomTableButton,
|
||||
'Vaccine',
|
||||
PrrByVaccineProvider.getPrrBySymptom);
|
||||
@@ -13,4 +13,13 @@ class PrrBySymptomTableView {
|
||||
displayPrrBySymptomTable4Vaccine(vaccine) {
|
||||
this.#delegate.displayPrrByKeyTable4Value(vaccine);
|
||||
}
|
||||
|
||||
#createPrrBySymptomTable(tableElement) {
|
||||
return new PrrByKeyTable({
|
||||
tableElement: tableElement,
|
||||
keyColumnName: 'Symptom',
|
||||
prrColumnName: 'Proportional Reporting Ratio > 1',
|
||||
shallMarkRowIfPrrTooHigh: false
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
class PrrByVaccineTable {
|
||||
|
||||
#delegate;
|
||||
|
||||
constructor(tableElement) {
|
||||
this.#delegate = new PrrByKeyTable({
|
||||
tableElement: tableElement,
|
||||
keyColumnName: 'Vaccine',
|
||||
prrColumnName: 'Proportional Reporting Ratio',
|
||||
shallMarkRowIfPrrTooHigh: true
|
||||
});
|
||||
}
|
||||
|
||||
initialize() {
|
||||
this.#delegate.initialize();
|
||||
}
|
||||
|
||||
display(prrByVaccine) {
|
||||
this.#delegate.display(prrByVaccine);
|
||||
}
|
||||
|
||||
getDisplayedTableAsCsv(heading) {
|
||||
return this.#delegate.getDisplayedTableAsCsv(heading);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ class PrrByVaccineTableView {
|
||||
|
||||
constructor(prrByVaccineTableElement, downloadPrrByVaccineTableButton) {
|
||||
this.#delegate = new PrrByKeyTableView(
|
||||
new PrrByVaccineTable(prrByVaccineTableElement),
|
||||
this.#createPrrByVaccineTable(prrByVaccineTableElement),
|
||||
downloadPrrByVaccineTableButton,
|
||||
'Symptom',
|
||||
PrrByVaccineProvider.getPrrByVaccine);
|
||||
@@ -13,4 +13,13 @@ class PrrByVaccineTableView {
|
||||
displayPrrByVaccineTable4Symptom(symptom) {
|
||||
this.#delegate.displayPrrByKeyTable4Value(symptom);
|
||||
}
|
||||
|
||||
#createPrrByVaccineTable(tableElement) {
|
||||
return new PrrByKeyTable({
|
||||
tableElement: tableElement,
|
||||
keyColumnName: 'Vaccine',
|
||||
prrColumnName: 'Proportional Reporting Ratio',
|
||||
shallMarkRowIfPrrTooHigh: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user