This commit is contained in:
WorldTeacher
2024-09-23 15:48:02 +02:00
parent e5816b40d2
commit e7efdc8481
7 changed files with 14 additions and 14 deletions

BIN
icons/library_shelf.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -17,9 +17,9 @@ class ExtendLoan(QtWidgets.QDialog, Ui_Dialog):
self.buttonBox.accepted.connect(self.extendLoan) self.buttonBox.accepted.connect(self.extendLoan)
def extendLoan(self): def extendLoan(self):
# print("Extend Loan") #print("Extend Loan")
selectedDate = self.extenduntil.selectedDate() selectedDate = self.extenduntil.selectedDate()
# print(selectedDate) #print(selectedDate)
self.extendDate = selectedDate self.extendDate = selectedDate
self.close() self.close()

View File

@@ -27,7 +27,7 @@ class MultiUserFound(QtWidgets.QDialog, Ui_Dialog):
self.tableWidget.cellClicked.connect(self.selectUser) self.tableWidget.cellClicked.connect(self.selectUser)
def selectUser(self, row, column): def selectUser(self, row, column):
# print(row, column) #print(row, column)
user = User( user = User(
id=self.tableWidget.item(row, 0).text(), id=self.tableWidget.item(row, 0).text(),
username=self.tableWidget.item(row, 1).text(), username=self.tableWidget.item(row, 1).text(),

View File

@@ -40,7 +40,7 @@ class NewEntry(QtWidgets.QDialog, Ui_Dialog):
) )
def populateTable(self): def populateTable(self):
for title in self.titles: for title in self.titles:
# print(title) #print(title)
entries = self.db.getMediaSimilarSignatureByID(title) entries = self.db.getMediaSimilarSignatureByID(title)
# sort by signature # sort by signature
entries.sort(key=lambda x: x.signature, reverse=True) entries.sort(key=lambda x: x.signature, reverse=True)
@@ -66,7 +66,7 @@ class NewEntry(QtWidgets.QDialog, Ui_Dialog):
signature=signature, signature=signature,
ppn=eval(ppn), ppn=eval(ppn),
) )
# print(book) #print(book)
if not self.db.checkMediaExists(book): if not self.db.checkMediaExists(book):
newBookId = self.db.insertMedia(book) newBookId = self.db.insertMedia(book)
self.newIds.append(newBookId) self.newIds.append(newBookId)

View File

@@ -90,7 +90,7 @@ class ReportUi(QtWidgets.QDialog, Ui_Dialog):
def report_generated(self): def report_generated(self):
self.reportlink.setOpenExternalLinks(True) self.reportlink.setOpenExternalLinks(True)
fileformat = self.rthread.format fileformat = self.rthread.format
print(fileformat) #print(fileformat)
self.reportlink.setText( self.reportlink.setText(
f'<a href="file:///{os.getcwd()}/report.{fileformat}">Report</a>' f'<a href="file:///{os.getcwd()}/report.{fileformat}">Report</a>'
) )

View File

@@ -72,11 +72,11 @@ class UserUI(QtWidgets.QMainWindow, Ui_MainWindow):
extend.exec() extend.exec()
if extend.result() == 1: if extend.result() == 1:
extendDate = extend.extendDate.toString("yyyy-MM-dd") extendDate = extend.extendDate.toString("yyyy-MM-dd")
# # print columns of selected rows # #print columns of selected rows
for item in self.UserMediaTable.selectedItems(): for item in self.UserMediaTable.selectedItems():
if item.column() == 1: if item.column() == 1:
signature = item.text() signature = item.text()
# print(signature) #print(signature)
self.db.extendLoanDuration(signature, extendDate) self.db.extendLoanDuration(signature, extendDate)
self.userMedia = [] self.userMedia = []
self.UserMediaTable.setRowCount(0) self.UserMediaTable.setRowCount(0)
@@ -91,7 +91,7 @@ class UserUI(QtWidgets.QMainWindow, Ui_MainWindow):
self.UserMediaTable.setRowCount(0) self.UserMediaTable.setRowCount(0)
for loan in self.userMedia: for loan in self.userMedia:
# print("looping loans") #print("looping loans")
fielddata = eval(f"loan.{searchfield}") fielddata = eval(f"loan.{searchfield}")
if isinstance(fielddata, str): if isinstance(fielddata, str):
fielddata = fielddata.lower() fielddata = fielddata.lower()
@@ -141,12 +141,12 @@ class UserUI(QtWidgets.QMainWindow, Ui_MainWindow):
if self.radio_currentlyLoaned.isChecked() if self.radio_currentlyLoaned.isChecked()
else "overdue" else "overdue"
) )
print(mode) #print(mode)
if self.userMedia == []: if self.userMedia == []:
books = self.db.getAllMedia(self.user_id) books = self.db.getAllMedia(self.user_id)
for book in books: for book in books:
self.userMedia.append(book) self.userMedia.append(book)
# print(self.userMedia) #print(self.userMedia)
self.UserMediaTable.setRowCount(0) self.UserMediaTable.setRowCount(0)
for book in self.userMedia: for book in self.userMedia:
@@ -166,7 +166,7 @@ class UserUI(QtWidgets.QMainWindow, Ui_MainWindow):
continue continue
self.addBookToTable(book) self.addBookToTable(book)
print(book.title) #print(book.title)
def addBookToTable(self, book): def addBookToTable(self, book):
self.UserMediaTable.insertRow(0) self.UserMediaTable.insertRow(0)
# item0 = isbn # item0 = isbn

View File

@@ -23,7 +23,7 @@ def generate_report():
report_path = os.path.join(config.report.path, f"report_{year}_{week}.tsv") report_path = os.path.join(config.report.path, f"report_{year}_{week}.tsv")
day = QDate.currentDate().addDays(-7).toString("yyyy-MM-dd") day = QDate.currentDate().addDays(-7).toString("yyyy-MM-dd")
query = f"""SELECT * FROM loans WHERE loan_date >= '{day}';""" query = f"""SELECT * FROM loans WHERE loan_date >= '{day}';"""
# print(query) #print(query)
colnames = ["UserId", "Title", "Action", "Datum"] colnames = ["UserId", "Title", "Action", "Datum"]
table = PrettyTable(colnames) table = PrettyTable(colnames)
@@ -49,7 +49,7 @@ def generate_report():
loan_action_date, loan_action_date,
] ]
) )
# # print(table) # #print(table)
# # wruitng the table to a file # # wruitng the table to a file
# with open("report.txt", "w", encoding="utf-8") as f: # with open("report.txt", "w", encoding="utf-8") as f:
# f.write(str(table)) # f.write(str(table))