remove debugs, only calc num_entries in Flat view once
This commit is contained in:
21
files.py
21
files.py
@@ -18,7 +18,8 @@ import cv2
|
||||
import time
|
||||
import re
|
||||
import json
|
||||
import datetime
|
||||
from datetime import datetime
|
||||
import pytz
|
||||
from flask_login import login_required, current_user
|
||||
from states import States, PA_UserState
|
||||
|
||||
@@ -179,6 +180,7 @@ def ClearJM_Message(id):
|
||||
# viewing / using pa_user_state DB table
|
||||
################################################################################
|
||||
def UpdatePref( pref, OPT ):
|
||||
last_used=datetime.now(pytz.utc)
|
||||
if OPT.current>0:
|
||||
pref.current=OPT.current
|
||||
if OPT.first_eid>0:
|
||||
@@ -187,6 +189,7 @@ def UpdatePref( pref, OPT ):
|
||||
pref.last_eid=OPT.last_eid
|
||||
if OPT.num_entries>0:
|
||||
pref.num_entries=OPT.num_entries
|
||||
pref.last_used=last_used
|
||||
db.session.add(pref)
|
||||
db.session.commit()
|
||||
|
||||
@@ -212,18 +215,11 @@ def GetEntriesInFlatView( OPT, prefix ):
|
||||
if OPT.first_eid == 0 and OPT.offset == 0 and len(entries):
|
||||
OPT.first_eid = entries[0].id
|
||||
|
||||
num_entries=Entry.query.join(File).join(EntryDirLink).join(Dir).join(PathDirLink).join(Path).filter(Path.path_prefix==prefix).count()
|
||||
|
||||
print( f"GetEntriesInFlatView - pfx={prefix}, ne={num_entries}" )
|
||||
|
||||
for e in entries:
|
||||
print( f"e={e.id}- {e.name}" )
|
||||
|
||||
if OPT.last_eid==0:
|
||||
num_entries=Entry.query.join(File).join(EntryDirLink).join(Dir).join(PathDirLink).join(Path).filter(Path.path_prefix==prefix).count()
|
||||
le=last_entry.all()
|
||||
if len(le):
|
||||
OPT.last_eid = le[0].id
|
||||
print("1st run, fe={OPT.first_eid}, le={OPT.last_eid}" )
|
||||
|
||||
return entries, num_entries
|
||||
|
||||
@@ -280,10 +276,6 @@ def GetEntriesInFolderView( OPT, prefix ):
|
||||
OPT.last_eid = le[0].id
|
||||
|
||||
entries += file_entries;
|
||||
print( f"FOLD, fe={OPT.first_eid}, le={OPT.last_eid}, ne={num_entries}" )
|
||||
for e in entries:
|
||||
print( f"FOLD e={e.id} - {e.type.name} - {e.name}" )
|
||||
|
||||
return entries, num_entries
|
||||
|
||||
################################################################################
|
||||
@@ -398,7 +390,6 @@ def GetEntries( OPT ):
|
||||
path_cnt += 1
|
||||
|
||||
if update_last_eid:
|
||||
print( f"num_ent={OPT.num_entries} -- need to SAVE this in pa_user_state")
|
||||
# find pref... via path_type if we are here
|
||||
OPT.num_entries=num_entries
|
||||
pref=PA_UserState.query.filter(PA_UserState.pa_user_dn==current_user.dn,PA_UserState.path_type==OPT.path_type).first()
|
||||
@@ -730,7 +721,7 @@ def view(id):
|
||||
# jic, sometimes we trip this, and rather than show broken pages / destroy
|
||||
# face locn data, just warn & redirect
|
||||
if id not in eids:
|
||||
print( f"OPT={OPT}, id={id}, eids={eids}")
|
||||
print( f"ERROR: viewing an id, but its not in eids OPT={OPT}, id={id}, eids={eids}")
|
||||
st.SetMessage("Sorry, viewing data is confused, cannot view this image now", "warning" )
|
||||
return redirect("/")
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user