bugfixes
This commit is contained in:
@@ -27,7 +27,6 @@ class ReportThread(QThread):
|
||||
path = db.db_path
|
||||
day = QDate.currentDate().addDays(-self.days).toString("yyyy-MM-dd")
|
||||
query = f"""SELECT * FROM loans WHERE loan_date >= '{day}';"""
|
||||
print(query)
|
||||
colnames = ["UserId", "Title", "Action", "Datum"]
|
||||
table = PrettyTable(colnames)
|
||||
table.align[colnames[0]] = "l"
|
||||
@@ -57,9 +56,12 @@ class ReportThread(QThread):
|
||||
)
|
||||
# # print(table)
|
||||
# # wruitng the table to a file
|
||||
if self.format == "csv":
|
||||
with open("report.csv", "w", encoding="utf-8") as f:
|
||||
f.write(table.get_csv_string())
|
||||
if self.format == "tsv":
|
||||
table = table.get_csv_string()
|
||||
tsv_table = table.replace(",", "\t")
|
||||
# write the file
|
||||
with open("report.tsv", "w", encoding="utf-8") as f:
|
||||
f.write(tsv_table)
|
||||
else:
|
||||
with open("report.txt", "w", encoding="utf-8") as f:
|
||||
f.write(str(table))
|
||||
|
||||
@@ -14,7 +14,7 @@ def stringToDate(date: str) -> QtCore.QDate:
|
||||
if not date:
|
||||
return ""
|
||||
if isinstance(date, QtCore.QDate):
|
||||
return date.toString("yyyy-MM-dd")
|
||||
return date
|
||||
else:
|
||||
datedata = date.split("-")
|
||||
day = datedata[2]
|
||||
|
||||
Reference in New Issue
Block a user