changed to fixed number of images per load, rather than complicating with week/month/year retrieval

This commit is contained in:
2021-02-01 23:13:38 +11:00
parent 2a5f607597
commit 5703664019
2 changed files with 162 additions and 140 deletions

View File

@@ -103,38 +103,28 @@ def file_list():
def files():
noo="Oldest"
grouping="Day"
which="Week"
how_many="50"
offset=0
if request.method=="POST":
noo=request.form['noo']
which=request.form['which']
how_many=request.form['how_many']
offset=int(request.form['offset'])
grouping=request.form['grouping']
print( f"noo={noo}, which={which}, grouping={grouping}")
if 'prev' in request.form:
offset -= int(how_many)
if offset < 0:
offset=0
if 'next' in request.form:
offset += int(how_many)
entries=[]
if noo == "Oldest":
year=File.query.order_by(File.year).first()
month=File.query.filter(File.year==year.year).order_by(File.month).first()
woy=File.query.filter(File.year==year.year).order_by(File.woy).first()
print( f"y={year}, m={month}, woy={woy}")
if which == "Week":
entries=Entry.query.join(File).filter(File.year==year.year).filter(File.woy==woy.woy).order_by(Entry.name).all()
elif which == "Month":
entries=Entry.query.join(File).filter(File.year==year.year).filter(File.month==month.month).order_by(Entry.name).all()
elif which == "Year":
entries=Entry.query.join(File).filter(File.year==year.year).order_by(Entry.name).all()
entries=Entry.query.join(File).order_by(File.year,File.month,File.day,Entry.name).offset(offset).limit(how_many).all()
else:
year=File.query.order_by(File.year.desc()).first()
month=File.query.filter(File.year==year.year).order_by(File.month.desc()).first()
woy=File.query.filter(File.year==year.year).order_by(File.woy.desc()).first()
if which == "Week":
entries=Entry.query.join(File).filter(File.year==year.year).filter(File.woy==woy.woy).order_by(Entry.name).all()
elif which == "Month":
entries=Entry.query.join(File).filter(File.year==year.year).filter(File.month==month.month).order_by(Entry.name).all()
elif which == "Year":
entries=Entry.query.join(File).filter(File.year==year.year).order_by(Entry.name).all()
return render_template("files.html", page_title='View Files', entry_data=entries, grouping=grouping, which=which, form=request.form )
entries=Entry.query.join(File).order_by(File.year.desc(),File.month.desc(),File.day.desc(),Entry.name).offset(offset).limit(how_many).all()
return render_template("files.html", page_title='View Files', entry_data=entries, grouping=grouping, how_many=how_many, offset=offset, form=request.form )
################################################################################
# /search -> show thumbnail view of files from import_path(s)