mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-29 15:36:36 +08:00
Fix markup
This commit is contained in:
parent
2da0a6c6bf
commit
6c7edbb9be
1 changed files with 28 additions and 29 deletions
|
|
@ -7,37 +7,36 @@ class RepositoryTableStateUpdate < ActiveRecord::Migration[6.0]
|
|||
|
||||
def up
|
||||
TempStateModel.find_each do |table_state|
|
||||
begin
|
||||
state = table_state.state
|
||||
state = table_state.state
|
||||
order_state = state.dig('order', 0, 0)
|
||||
|
||||
unless order_state
|
||||
order = state.dig('order', '0')
|
||||
state['order'] = [order]
|
||||
order_state = state.dig('order', 0, 0)
|
||||
|
||||
unless order_state
|
||||
order = state.dig('order', '0')
|
||||
state['order'] = [order]
|
||||
order_state = state.dig('order', 0, 0)
|
||||
end
|
||||
|
||||
state['order'][0][0] = order_state.to_i + 2 if order_state.to_i > 5
|
||||
|
||||
if state['columns'].class == Hash
|
||||
columns_array = []
|
||||
state['columns'].each{ |k, v| columns_array[k.to_i] = v}
|
||||
state['columns'] = columns_array
|
||||
end
|
||||
|
||||
2.times do
|
||||
state['columns'].insert(6,
|
||||
'search' => {
|
||||
'regex' => false, 'smart' => true, 'search' => '', 'caseInsensitive' => true
|
||||
},
|
||||
'visible' => false)
|
||||
end
|
||||
state['ColReorder'] = state['ColReorder'].map { |i| i.to_i > 5 ? i.to_i + 2 : i.to_i } + [6, 7] if state['ColReorder']
|
||||
table_state.update(state: state)
|
||||
rescue
|
||||
next
|
||||
end
|
||||
|
||||
state['order'][0][0] = order_state.to_i + 2 if order_state.to_i > 5
|
||||
|
||||
if state['columns'].class == Hash
|
||||
columns_array = []
|
||||
state['columns'].each { |k, v| columns_array[k.to_i] = v }
|
||||
state['columns'] = columns_array
|
||||
end
|
||||
|
||||
2.times do
|
||||
state['columns'].insert(6,
|
||||
'search' => {
|
||||
'regex' => false, 'smart' => true, 'search' => '', 'caseInsensitive' => true
|
||||
},
|
||||
'visible' => false)
|
||||
end
|
||||
if state['ColReorder']
|
||||
state['ColReorder'] = state['ColReorder'].map { |i| i.to_i > 5 ? i.to_i + 2 : i.to_i } + [6, 7]
|
||||
end
|
||||
table_state.update(state: state)
|
||||
rescue StandardError
|
||||
next
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue