added # matches on show persons page, and fixed issue with search OPT being hardcoded and not using those in the DB

This commit is contained in:
2022-01-16 00:55:23 +11:00
parent 05f12e78ea
commit 12726ed186
4 changed files with 37 additions and 18 deletions

View File

@@ -95,6 +95,15 @@ class PersonForm(FlaskForm):
@login_required
def persons():
persons = Person.query.all()
# get the num matches for each person too, and allow link for it
stats = list( db.session.execute( "select p.tag, count(f.id) from person p, face f, face_file_link ffl, face_refimg_link frl, person_refimg_link prl where p.id = prl.person_id and prl.refimg_id = frl.refimg_id and frl.face_id = ffl.face_id and ffl.face_id = f.id group by p.tag" ) )
for p in persons:
if not p.refimg:
continue
for s in stats:
if p.tag == s[0]:
p.num_matches = s[1];
break
return render_template("persons.html", persons=persons)