]> Softwares of Agnibho - librevax.git/commitdiff
Vaccine count in daily report
authorAgnibho Mondal <mondal@agnibho.com>
Tue, 5 Mar 2024 21:17:30 +0000 (02:47 +0530)
committerAgnibho Mondal <mondal@agnibho.com>
Tue, 5 Mar 2024 21:17:30 +0000 (02:47 +0530)
librevax.py
templates/report.html

index 9967b59d7cba2dded9a7f80660d31706eca7ce50..d5ea3b8db7e409162337c3cfc4200f47fec7a066 100644 (file)
@@ -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)
index a67a0194aeca31d331dba1083122a5a471bea956..4c0ca4de7259d4a478dc826a0b39d2d4dff4e516 100644 (file)
@@ -44,5 +44,10 @@ You should have received a copy of the GNU General Public License along with Lib
     </tr>
     {% endfor %}
   </table>
+  <p>Vaccine Administerd:
+  {% for k,v in count.items() %}
+  &emsp;{{k}} ({{v}})
+  {% endfor %}
+  </p>
 </div>
 {% endblock %}