fix up linking between face to refimg when we add that face to a person from right-click
This commit is contained in:
4
TODO
4
TODO
@@ -1,8 +1,8 @@
|
||||
###
|
||||
#
|
||||
# fix all face, right-click options:
|
||||
# partial fix for face to new and existing person - the person and refimg
|
||||
# data are correct, but the face_file_link is not connected (do this in person) - and if we do run AI jobs, they will overwrite it anyway (watch out for race condition)
|
||||
# [DONE] add to new, add to existing
|
||||
# [TODO] 4 x override*
|
||||
#
|
||||
#1 get override data into view
|
||||
# also all the add ref img/add override, etc are non-functional - FIX the override* stuff first to get table/naming consistency as that is half the problem
|
||||
|
||||
10
person.py
10
person.py
@@ -295,6 +295,7 @@ def find_persons(who):
|
||||
|
||||
class FaceRefimgLinkSchema(ma.SQLAlchemyAutoSchema):
|
||||
class Meta: model = FaceRefimgLink
|
||||
face_distance = ma.auto_field() # Explicitly include face_distance
|
||||
load_instance = True
|
||||
|
||||
class PersonSchema(ma.SQLAlchemyAutoSchema):
|
||||
@@ -331,6 +332,11 @@ def add_refimg_to_person():
|
||||
fname=TempRefimgFile( request.form['refimg_data'], p.tag )
|
||||
r=AddRefimgToPerson( fname, p )
|
||||
|
||||
# connect the refimg to the face in the db, now we have added this refimg to the person
|
||||
frl=FaceRefimgLink( face_id=f.id, refimg_id=r.id, face_distance=0 )
|
||||
db.session.add(frl)
|
||||
db.session.commit()
|
||||
|
||||
if request.form['search'] == "true":
|
||||
jex=[]
|
||||
ptype=PathType.query.filter(PathType.name=='Import').first()
|
||||
@@ -346,8 +352,10 @@ def add_refimg_to_person():
|
||||
|
||||
refimg_schema=RefimgSchema(many=False)
|
||||
r_data=refimg_schema.dump(r)
|
||||
frl_schema=FaceRefimgLinkSchema(many=False)
|
||||
frl_data=refimg_schema.dump(r)
|
||||
|
||||
return make_response( jsonify( refimg=r_data, who=p.tag, distance='0.0' ) )
|
||||
return make_response( jsonify( refimg=r_data, frl=frl_data ) )
|
||||
|
||||
################################################################################
|
||||
# /add_force_match_override -> POST
|
||||
|
||||
Reference in New Issue
Block a user