Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bulk delete, bulk archive/unarchive, and bulk metadata edit buttons in books table page #3113

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
d0d9985
Add bulk delete button
jmarmstrong1207 Aug 2, 2024
d9a2a7a
Add bulk archive/unarchive buttons
jmarmstrong1207 Aug 2, 2024
ca9fc74
typo fix
jmarmstrong1207 Aug 2, 2024
34fec0e
Move buttons into table
jmarmstrong1207 Aug 2, 2024
4ed0633
Add bulk read/unread buttons; Fix buttons not working when moved into…
jmarmstrong1207 Aug 2, 2024
ecda717
Add bulk metadata edit button
jmarmstrong1207 Aug 2, 2024
ab3d4e4
Fix emptying metadata form after submit
jmarmstrong1207 Aug 3, 2024
9def910
switch title_sort to sort in api edit request
jmarmstrong1207 Aug 3, 2024
96fb2c1
Auto disable author/title sort input in metadata edit form
jmarmstrong1207 Aug 3, 2024
a335dd7
Make edit metadata pass all data in a single REST call. Modularize ed…
jmarmstrong1207 Aug 3, 2024
bee6a35
remove spacing
jmarmstrong1207 Aug 3, 2024
e31763d
Fix kobo sync status marking as archived even though state = false
jmarmstrong1207 Aug 3, 2024
2ae80d3
Fix book_read_status marking as read even though read_status is passe…
jmarmstrong1207 Aug 3, 2024
2afce66
Fix change_archived so state=none is a toggle. Fixes /togglearchived …
jmarmstrong1207 Aug 3, 2024
de3f883
Add change_archived_books() description
jmarmstrong1207 Aug 3, 2024
fe78222
Add shift-click to select multiple books at once
jmarmstrong1207 Aug 5, 2024
7e5d897
Merge branch 'master' into bulk-delete
jmarmstrong1207 Sep 11, 2024
31380f2
fix typo
jmarmstrong1207 Sep 17, 2024
338441f
fix author sort not updating when bulk editing
jmarmstrong1207 Sep 17, 2024
54d9d33
Revert "Add shift-click to select multiple books at once"
jmarmstrong1207 Sep 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cps/kobo_sync_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ def remove_synced_book(book_id, all=False, session=None):
def change_archived_books(book_id, state=None, message=None):
archived_book = ub.session.query(ub.ArchivedBook).filter(and_(ub.ArchivedBook.user_id == int(current_user.id),
ub.ArchivedBook.book_id == book_id)).first()
if not archived_book:
if not archived_book and state == True:
Copy link
Author

@jmarmstrong1207 jmarmstrong1207 Aug 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes it so only requests to archive (ie state = true) actually creates an archivedbook listing.

Edit: Made line 57 if not archived_book and (state == True or state == None) so state=None makes the function a toggler. Otherwise, not adding or state == None will make it not create an archivedbook listing when someone tries to use the /togglearchived endpoint on a brand new, never-archived book

archived_book = ub.ArchivedBook(user_id=current_user.id, book_id=book_id)

archived_book.is_archived = state if state else not archived_book.is_archived
archived_book.is_archived = state if state != None else not archived_book.is_archived
Copy link
Author

@jmarmstrong1207 jmarmstrong1207 Aug 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, bulk unarchiving on already-unarchived books will actually archive them instead. Without this, this function is just a toggler if state is false.

Same exact thing with edit_book_read_status is fixed in the commit below

archived_book.last_modified = datetime.datetime.utcnow() # toDo. Check utc timestamp

ub.session.merge(archived_book)
Expand Down