diff options
| author | root <root@turin.home> | 2022-02-05 21:45:23 +0000 |
|---|---|---|
| committer | root <root@turin.home> | 2022-02-05 21:45:23 +0000 |
| commit | f7aa28c8ee07f954294045ecb658a7e8c764cfa2 (patch) | |
| tree | 47c93943763efbaa85e9c81bcaace27d71745559 /main.py | |
| parent | df7e05fea4a14d6749eb476ae4e66b4f2a771a19 (diff) | |
Diffstat (limited to 'main.py')
| -rw-r--r-- | main.py | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -9,6 +9,7 @@ import dates from flask import Flask, render_template, redirect, url_for from threading import Thread +import os app = Flask(__name__) @@ -106,13 +107,13 @@ def export(opt): for i in data: if data[1] == 1: days.inc(data[0], 1 / STEPS * 100) - days.sort_by_value() con.close() + days.sort_by_value() # writing data to a file - # with open("static/export.txt", "w") as file: - # file.write(o) - # return redirect("/static/export.txt") - return True + with open("static/table.ms", "w") as file: + file.write(days.roff_tbl()) + os.system("groff -Tpdf -P-pa4 -tk static/table.ms > static/table.pdf") + return redirect("/static/table.pdf") else: return render_template( "error.html", error="Invalid export type" |
