diff --git a/ai.py b/ai.py index 89eb867..45a278c 100644 --- a/ai.py +++ b/ai.py @@ -21,7 +21,7 @@ from face import Face, FaceFileLink, FaceRefimgLink @app.route("/aistats", methods=["GET", "POST"]) @login_required def aistats(): - stats = 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" ) + stats = 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 order by 2 desc" ) cnt_res = db.session.execute( "select count(1) from ( select p.tag 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 ) as foo" ) num_stats=cnt_res.first()[0] diff --git a/templates/aistats.html b/templates/aistats.html index c62909d..07d0456 100644 --- a/templates/aistats.html +++ b/templates/aistats.html @@ -6,7 +6,8 @@ background: #cfe2ff } -