refactoring

This commit is contained in:
frankknoll
2023-10-10 10:50:12 +02:00
parent d2ad1b805a
commit 0270d385a2
2 changed files with 9 additions and 7 deletions

View File

@@ -1,27 +1,28 @@
from bs4 import BeautifulSoup
from HtmlTransformerUtil import HtmlTransformerUtil
from DateProvider import DateProvider
from SymptomsCausedByVaccines.Analyzer import Analyzer
from SymptomsCausedByVaccines.HtmlUtils import getVaccineOptions
from SymptomsCausedByVaccines.OptionsSetter import OptionsSetter
def updateHtmlFile(symptomByVaccine, htmlFile, lastUpdated):
vaccineOptions = getVaccineOptions(Analyzer(symptomByVaccine).getVaccines())
_saveVaccineOptions(vaccineOptions, htmlFile)
def updateHtmlFile(vaccines, htmlFile, lastUpdated):
_saveVaccineOptions(
vaccineOptions = getVaccineOptions(vaccines),
htmlFile = htmlFile,
vaccineSelectElementId = 'vaccineSelect')
saveLastUpdated2HtmlFile(
lastUpdated = lastUpdated,
htmlFile = htmlFile,
lastUpdatedElementId = 'last_updated')
def _saveVaccineOptions(vaccineOptions, htmlFile):
def _saveVaccineOptions(vaccineOptions, htmlFile, vaccineSelectElementId):
HtmlTransformerUtil().applySoupTransformerToFile(
file=htmlFile,
soupTransformer = lambda soup:
BeautifulSoup(
OptionsSetter().setOptions(
html = str(soup),
selectElementId = 'vaccineSelect',
selectElementId = vaccineSelectElementId,
options = vaccineOptions),
'lxml'))