Skip to content

Commit 75c9256

Browse files
author
Fabien Daoulas
committed
Insert reviewed value last [sc-182632]
1 parent 020166c commit 75c9256

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

dss-plugin-visual-edit/python-lib/DataEditor.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -461,13 +461,22 @@ def update_row(
461461
"""
462462
key = get_key_values_from_dict(primary_keys, self.primary_keys)
463463

464+
def is_reviewed_column(column_name: str):
465+
return column_name == "Reviewed" or column_name == "reviewed"
466+
467+
def is_comments_column(column_name: str):
468+
return column_name == "Comments" or column_name == "comments"
469+
464470
# for reviewed column, create an editlog for each columns to enforce values even after a change in the original.
465-
if column == "Reviewed" or column == "reviewed":
471+
# Append the reviewed value change last in case something goes wrong during updates of the previous column values.
472+
# To improve this, the best would be to do all the inserts in the same transaction.
473+
if is_reviewed_column(column):
466474
results = []
467475
for col in self.editable_column_names:
468-
if col != "Comments" and col != "comments":
476+
if not is_comments_column(col) and not is_reviewed_column(col):
469477
# contains values for primary keys — and other columns too, but they'll be discarded
470478
results.append(self.__log_edit__(key, col, primary_keys[col]))
479+
results.append(self.__log_edit__(key, column, primary_keys[column]))
471480
return results
472481
else:
473482
return [self.__log_edit__(key, column, value, action="update")]

0 commit comments

Comments
 (0)