From dbc0020fa1b74e25580fd734fb7e1184b891aab5 Mon Sep 17 00:00:00 2001 From: Tim Bradgate Date: Tue, 27 Jun 2023 17:08:04 +0100 Subject: [PATCH] Fix: Editing the script no longer breaks the DB --- server/controllers/api/show/script.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server/controllers/api/show/script.py b/server/controllers/api/show/script.py index f5ff7a9f..edfd06cb 100644 --- a/server/controllers/api/show/script.py +++ b/server/controllers/api/show/script.py @@ -671,6 +671,13 @@ async def patch(self): if previous_line: previous_line.next_line = line_object curr_association.previous_line = previous_line.line + + if curr_association.next_line: + next_association: ScriptLineRevisionAssociation = session.query( + ScriptLineRevisionAssociation).get( + {'revision_id': revision.id, + 'line_id': curr_association.next_line.id}) + next_association.previous_line = line_object session.flush() if len(curr_line.revision_associations) == 0: