From 6a50f7f27e53fea40d1338a48893fe09d0da52be Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Wed, 5 Aug 2020 13:15:38 +0200 Subject: [PATCH] Improve handling of old repository table states [SCI-4889] --- .../repository_table_state_column_update_service.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/services/repository_table_state_column_update_service.rb b/app/services/repository_table_state_column_update_service.rb index e32b0acee..57d5c25a4 100644 --- a/app/services/repository_table_state_column_update_service.rb +++ b/app/services/repository_table_state_column_update_service.rb @@ -44,18 +44,18 @@ class RepositoryTableStateColumnUpdateService end end - if state.dig('order', 0, 0) == old_column_index + if state.dig('order', 0, 0).to_i == old_column_index # Fallback to default order if user had table ordered by # the deleted column state['order'] = Constants::REPOSITORY_TABLE_DEFAULT_STATE['order'] - elsif state.dig('order', 0, 0) > old_column_index + elsif state.dig('order', 0, 0).to_i > old_column_index state['order'][0][0] -= 1 end state['length'] = (state['length'] - 1) state['time'] = (Time.now.to_f * 1_000).to_i table_state.save - rescue NoMethodError => e + rescue StandardError => e Rails.logger.error e.message RepositoryTableStateService.new(user, repository).create_default_state end