Commit e27f3db1 authored by Remi Rampin's avatar Remi Rampin

WIP Fix merging tags with common highlights

parent ba1099da
Pipeline #77605389 passed with stage
in 2 minutes and 30 seconds
...@@ -356,12 +356,22 @@ class TagMerge(BaseHandler): ...@@ -356,12 +356,22 @@ class TagMerge(BaseHandler):
tag_dest is None or tag_dest.project_id != tag_dest is None or tag_dest.project_id !=
self.set_status(404) self.set_status(404)
return self.send_json({'error': "No such tag"}) return self.send_json({'error': "No such tag"})
# Remove tag from tag_src if it's already in tag_dest
.filter(database.HighlightTag.tag_id ==
.filter("ALSO HAS tag_dest -- SUBQUERY?")
# Update tags that are in tag_src to be in tag_dest
self.db.execute( self.db.execute(
database.HighlightTag.__table__.update() database.HighlightTag.__table__.update()
.where(database.HighlightTag.tag_id == .where(database.HighlightTag.tag_id ==
.values( .values(
) )
# Delete tag_src
self.db.delete(tag_src) self.db.delete(tag_src)
cmd = database.Command.tag_merge( cmd = database.Command.tag_merge(
self.current_user, self.current_user,,,
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment