mirror of
https://gitlab.com/LazyLibrarian/LazyLibrarian.git
synced 2026-02-06 10:47:15 +00:00
Changes for Requester being null
This commit is contained in:
parent
90c5d7b873
commit
2cbc9f0a2c
@ -1111,9 +1111,9 @@ def set_genres(genrelist=None, bookid=None):
|
||||
(match['GenreID'], bookid), suppress='UNIQUE')
|
||||
if CONFIG.get_bool('WISHLIST_GENRES'):
|
||||
book = db.match('SELECT Requester,AudioRequester from books WHERE BookID=?', (bookid,))
|
||||
if book['Requester'] is not None and book['Requester'] not in genrelist:
|
||||
if book['Requester'] and book['Requester'] not in genrelist:
|
||||
genrelist.insert(0, book['Requester'])
|
||||
if book['AudioRequester'] is not None and book['AudioRequester'] not in genrelist:
|
||||
if book['AudioRequester'] and book['AudioRequester'] not in genrelist:
|
||||
genrelist.insert(0, book['AudioRequester'])
|
||||
db.action('UPDATE books set BookGenre=? WHERE BookID=?', (', '.join(genrelist), bookid))
|
||||
finally:
|
||||
|
||||
@ -770,6 +770,21 @@ def check_db(upgradelog=None):
|
||||
logger.warning(msg)
|
||||
db.action("UPDATE books SET BookDate='0000' WHERE BookDate is NULL or BookDate=''")
|
||||
|
||||
# update Requester and AudioRequester from NULL to ''
|
||||
lazylibrarian.UPDATE_MSG = 'Updating Requester/AudioRequester'
|
||||
books = db.select("SELECT * FROM books WHERE Requester is NULL")
|
||||
if books:
|
||||
cnt += len(books)
|
||||
msg = f"Found {len(books)} {plural(len(books), 'book')} with Requester as NULL"
|
||||
logger.warning(msg)
|
||||
db.action("UPDATE books SET Requester='' WHERE Requester is NULL")
|
||||
books = db.select("SELECT * FROM books WHERE AudioRequester is NULL")
|
||||
if books:
|
||||
cnt += len(books)
|
||||
msg = f"Found {len(books)} {plural(len(books), 'book')} with AudioRequester as NULL"
|
||||
logger.warning(msg)
|
||||
db.action("UPDATE books SET AudioRequester='' WHERE AudioRequester is NULL")
|
||||
|
||||
# delete any duplicate entries in member table and add a unique constraint if not already done
|
||||
cmd = "SELECT * from sqlite_master WHERE type= 'index' and tbl_name = 'member' and name = 'unq'"
|
||||
match = db.match(cmd)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user