From 6ea9453626a5d8f749ab98ea8701765e83c63c73 Mon Sep 17 00:00:00 2001 From: Gabriele De Rosa Date: Fri, 21 May 2021 15:08:13 +0200 Subject: [PATCH] Minor improvements --- assets/templates/plot.html | 1 + bot.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/assets/templates/plot.html b/assets/templates/plot.html index c6a4e76..7b321a5 100644 --- a/assets/templates/plot.html +++ b/assets/templates/plot.html @@ -48,6 +48,7 @@ Somministrazioni +
diff --git a/bot.py b/bot.py index 0e323fc..c2e107c 100644 --- a/bot.py +++ b/bot.py @@ -101,9 +101,10 @@ def generate(df, target, template): vaccinesPerDayAverage = sum(lastWeekData[target]) / 7 remainingDays = (HIT - totalVaccines) / vaccinesPerDayAverage hitDate = df.index[-1] + td(days=remainingDays) + first_or_second = 'Seconda Dose' if target == 'seconda_dose' else 'Prima Dose' if target == 'prima_dose' else 'Totale' # Generate plot - plt.ylabel('Seconda Dose' if target == 'seconda_dose' else 'Prima Dose' if target == 'prima_dose' else 'Totale') + plt.ylabel(first_or_second) plt.xlabel("Ultima settimana") plt.grid(True) plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m-%d')) @@ -130,6 +131,8 @@ def generate(df, target, template): for line in f.read().splitlines(): if "" in line: line = f"{totalVaccines}" + elif "" in line: + line = f"{first_or_second}" elif "" in line: line = f"{str(round(totalVaccines / ITALIAN_POPULATION * 100, 2)).replace('.', ',')}%" elif "" in line: