From 55b4ac98bc7c464b60229576375d5774f40b8252 Mon Sep 17 00:00:00 2001 From: Agnibho Mondal Date: Wed, 6 Mar 2024 02:47:30 +0530 Subject: [PATCH] Vaccine count in daily report --- librevax.py | 8 +++++++- templates/report.html | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/librevax.py b/librevax.py index 9967b59..d5ea3b8 100644 --- a/librevax.py +++ b/librevax.py @@ -778,7 +778,13 @@ def report(mid): (ok, center)=multicenter.read(cursor, g.mid) if(not ok): raise Exception(center) - return render_template("report.html", data=data, center=center, date=date) + count={} + for i in data: + try: + count[i["vaccine"]]=count[i["vaccine"]]+i["dosage"] + except KeyError: + count[i["vaccine"]]=i["dosage"] + return render_template("report.html", data=data, count=count, center=center, date=date) except Exception as e: raise(e) return render_template("error.html", data=e) diff --git a/templates/report.html b/templates/report.html index a67a019..4c0ca4d 100644 --- a/templates/report.html +++ b/templates/report.html @@ -44,5 +44,10 @@ You should have received a copy of the GNU General Public License along with Lib {% endfor %} +

Vaccine Administerd: + {% for k,v in count.items() %} +  {{k}} ({{v}}) + {% endfor %} +

{% endblock %} -- 2.39.5