From: Agnibho Mondal Date: Tue, 5 Mar 2024 21:17:30 +0000 (+0530) Subject: Vaccine count in daily report X-Git-Url: https://code.agnibho.com/repo?a=commitdiff_plain;h=55b4ac98bc7c464b60229576375d5774f40b8252;p=librevax.git Vaccine count in daily report --- 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 %}