order ai stats, and remember to put a container div in for formatting

This commit is contained in:
2021-09-17 18:38:39 +10:00
parent c4f1a25750
commit 5b4bbeec46
2 changed files with 4 additions and 2 deletions

2
ai.py
View File

@@ -21,7 +21,7 @@ from face import Face, FaceFileLink, FaceRefimgLink
@app.route("/aistats", methods=["GET", "POST"]) @app.route("/aistats", methods=["GET", "POST"])
@login_required @login_required
def aistats(): 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" ) 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] num_stats=cnt_res.first()[0]

View File

@@ -6,7 +6,8 @@
background: #cfe2ff background: #cfe2ff
} }
</style> </style>
<h3>Basic AI stats</h3> <div class="container-fluid">
<h3>Basic AI stats</h3>
<div class="row mt-3"> <div class="row mt-3">
<div class="col-3 bgb"><b>What</b></div><div class="col-1 bgb"><center><b>Amount</b></center></div> <div class="col-3 bgb"><b>What</b></div><div class="col-1 bgb"><center><b>Amount</b></center></div>
</div> <div class="row"> </div> <div class="row">
@@ -60,4 +61,5 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</div> </div>
</div class="container-fluid">
{% endblock main_content %} {% endblock main_content %}