From 18ec0f87f537c946b788d3f6e402dce550cb19ed Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Fri, 10 Jun 2022 16:49:03 +1000 Subject: [PATCH] fixed BUG-86 - last places changed from locn to tmp_locn --- BUGs | 1 - files.py | 5 +++-- templates/viewer.html | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/BUGs b/BUGs index 3a93e1b..7001b5f 100644 --- a/BUGs +++ b/BUGs @@ -1,7 +1,6 @@ ### Next: 88 BUG-60: entries per page in flat view will get how_many from each top-level dir in PATH - causes viewer to get lost in eids for last_eid BUG-85: once we rebuild data from scratch, need to reset just clean out pa_user_state's -BUG-86: had some face locn data be in { } not [ ] again -- I think we need to stop using locn in the DB and instead use a tmp_locn or something else -- no way to touch the DB data then BUG-87: using Person->show matches->then view an image shows bug in viewer with msising data in json -- that same image via a filename search works... -- seems some faces have an empty locn, but do have a w and h... (ORM - tmp_locn vs locn???) # select id, locn, w, h from face where locn is null; diff --git a/files.py b/files.py index bd2dd20..88458d0 100644 --- a/files.py +++ b/files.py @@ -666,6 +666,7 @@ def viewlist(): resp['objs'][e.id]['name'] = e.name resp['objs'][e.id]['type'] = e.type.name if e.file_details.faces: + # model is used for whole file, so set it at that level (based on first face) resp['objs'][e.id]['face_model'] = e.file_details.faces[0].facefile_lnk.model_used resp['objs'][e.id]['faces'] = [] @@ -724,11 +725,11 @@ def view(id): # put locn data back into array format for face in e.file_details.faces: if face.locn: - face.locn = json.loads(face.locn) + face.tmp_locn = json.loads(face.locn) else: # this at least stops a 500 server error - seems to occur when # DB contains disconnected faces with no locn data - BUG: 87 - face.locn = [ 0,0,0,0 ] + face.tmp_locn = [ 0,0,0,0 ] st.SetMessage( f"For some reason this face does not have a locn: face_id={face.id} tell ddp", "warning" ) diff --git a/templates/viewer.html b/templates/viewer.html index 4a65d12..414f98e 100644 --- a/templates/viewer.html +++ b/templates/viewer.html @@ -41,8 +41,8 @@ {% for face in objs[id].file_details.faces %} data = { 'id': '{{face.id}}', - 'x': '{{face.locn[3]}}', 'y': '{{face.locn[0]}}', - 'w': '{{face.locn[1]-face.locn[3]}}', 'h':'{{face.locn[2]-face.locn[0]}}' + 'x': '{{face.tmp_locn[3]}}', 'y': '{{face.tmp_locn[0]}}', + 'w': '{{face.tmp_locn[1]-face.tmp_locn[3]}}', 'h':'{{face.tmp_locn[2]-face.tmp_locn[0]}}' } {% if face.refimg %} data['who']='{{face.refimg.person.tag}}'