Skip to content
Snippets Groups Projects
Commit 5e9fac6b authored by Kien Le's avatar Kien Le
Browse files

Remove unneeded if statement

parent 0d294284
No related branches found
No related tags found
1 merge request!289Fix problems with database editor tables that have no row
Pipeline #3846 passed with stage
in 7 minutes and 20 seconds
...@@ -773,16 +773,16 @@ class UiDBInfoDialog(OneWindowAtATimeDialog): ...@@ -773,16 +773,16 @@ class UiDBInfoDialog(OneWindowAtATimeDialog):
for row_idx in range(self.data_table_widget.rowCount()) for row_idx in range(self.data_table_widget.rowCount())
] ]
duplicated_primary_keys = get_duplicates(primary_keys) duplicated_primary_keys = get_duplicates(primary_keys)
if duplicated_primary_keys: msg = ''
msg = '' for primary_key, indices in duplicated_primary_keys.items():
for primary_key, indices in duplicated_primary_keys.items(): # .join() only accepts iterables of strings, so we have to do
# .join() only accepts iterables of strings, so we have to do # a quick conversion here.
# a quick conversion here. str_indices = [str(i) for i in indices]
str_indices = [str(i) for i in indices] msg += (f'Rows {", ".join(str_indices)}: '
msg += (f'Rows {", ".join(str_indices)}: ' f'Primary key "{primary_key}" is duplicated.\n')
f'Primary key "{primary_key}" is duplicated.\n') # Remove the final new line for better display.
# Remove the final new line for better display. msg = msg.strip('\n')
msg = msg.strip('\n') if msg:
return False, msg return False, msg
changed_row_ids = [idx changed_row_ids = [idx
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment