diff --git a/src/database/book_category_statistics.py b/src/database/book_category_statistics.py new file mode 100644 index 0000000..6c67bcd --- /dev/null +++ b/src/database/book_category_statistics.py @@ -0,0 +1,9 @@ +from sqlalchemy.orm import Session +from sqlalchemy import update + +from models import BookCategoryStatistics, Book + +def update_category_statistics(session: Session, book_id: int): + statistics = session.query(BookCategoryStatistics).get(book_id) + + \ No newline at end of file diff --git a/src/ui/editor/book_editor.py b/src/ui/editor/book_editor.py index 1bd37e9..db367f4 100644 --- a/src/ui/editor/book_editor.py +++ b/src/ui/editor/book_editor.py @@ -22,6 +22,7 @@ class BookEditor(QDialog): self.create_layout() if book: + self.book_id = book.id self.logger.debug(f"Editing existing book {book.title}") self.create_new = False self.fill_with_existing_data(book) @@ -100,6 +101,7 @@ class BookEditor(QDialog): if self.create_new: create_book(book_object) else: + book_object["id"] = self.book_id update_book(book_object) QMessageBox.information(None, diff --git a/src/utils/config.py b/src/utils/config.py index 2bcbdce..e5ece7d 100644 --- a/src/utils/config.py +++ b/src/utils/config.py @@ -78,8 +78,10 @@ class UserConfig: return cls._instance def __init__(self): - self._transaction_level = TransactionLevel.insecure - self._simulate_slowdown = False + if not hasattr(self, "_transaction_level"): + self._transaction_level = TransactionLevel.insecure + if not hasattr(self, "_simulate_slowdown"): + self._simulate_slowdown = False @property def transaction_level(self) -> TransactionLevel: