@ -970,7 +970,7 @@ def get_tasks_status():
@app.route ( " /reconnect " )
@app.route ( " /reconnect " )
def reconnect ( ) :
def reconnect ( ) :
db . reconnect_db ( config )
db . reconnect_db ( config , ub . app_DB_path )
return json . dumps ( { } )
return json . dumps ( { } )
@ -1154,30 +1154,33 @@ def advanced_search():
def render_read_books ( page , are_read , as_xml = False , order = None , * args , * * kwargs ) :
def render_read_books ( page , are_read , as_xml = False , order = None , * args , * * kwargs ) :
order = order or [ ]
order = order or [ ]
if not config . config_read_column :
if not config . config_read_column :
readBooks = ub . session . query ( ub . ReadBook ) . filter ( ub . ReadBook . user_id == int ( current_user . id ) ) \
. filter ( ub . ReadBook . read_status == ub . ReadBook . STATUS_FINISHED ) . all ( )
readBookIds = [ x . book_id for x in readBooks ]
if are_read :
if are_read :
db_filter = db . Books . id . in_ ( readBookIds )
db_filter = and_ ( ub . ReadBook . user_id == int ( current_user . id ) ,
ub . ReadBook . read_status == ub . ReadBook . STATUS_FINISHED )
else :
else :
db_filter = ~ db . Books . id . in_ ( readBookIds )
db_filter = coalesce ( ub . ReadBook . read_status , 0 ) != ub . ReadBook . STATUS_FINISHED
entries , random , pagination = fill_indexpage ( page , db . Books , db_filter , order )
entries , random , pagination = fill_indexpage ( page , db . Books ,
db_filter ,
order ,
ub . ReadBook , db . Books . id == ub . ReadBook . book_id )
else :
else :
try :
try :
if are_read :
if are_read :
db_filter = db . cc_classes [ config . config_read_column ] . value == True
db_filter = db . cc_classes [ config . config_read_column ] . value == True
else :
else :
db_filter = coalesce ( db . cc_classes [ config . config_read_column ] . value , False ) != True
db_filter = coalesce ( db . cc_classes [ config . config_read_column ] . value , False ) != True
# book_count = db.session.query(func.count(db.Books.id)).filter(common_filters()).filter(db_filter).scalar()
entries , random , pagination = fill_indexpage ( page , db . Books ,
entries , random , pagination = fill_indexpage ( page , db . Books ,
db_filter ,
db_filter ,
order ,
order ,
db . cc_classes [ config . config_read_column ] )
db . cc_classes [ config . config_read_column ] )
except KeyError :
except KeyError :
log . error ( " Custom Column No. %d is not existing in calibre database " , config . config_read_column )
log . error ( " Custom Column No. %d is not existing in calibre database " , config . config_read_column )
book_count = 0
if not as_xml :
flash ( _ ( " Custom Column No. %(column)d is not existing in calibre database " ,
column = config . config_read_column ) ,
category = " error " )
return redirect ( url_for ( " web.index " ) )
# ToDo: Handle error Case for opds
if as_xml :
if as_xml :
return entries , pagination
return entries , pagination
else :
else :