From 1fa0351adf5b05cc6350f102abd1f133adcf06e9 Mon Sep 17 00:00:00 2001 From: Bohung Date: Fri, 1 Apr 2022 16:38:50 +0800 Subject: [PATCH] Fix bug. --- app/controllers/admin/universal_tables_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/universal_tables_controller.rb b/app/controllers/admin/universal_tables_controller.rb index a03d82b..528a856 100644 --- a/app/controllers/admin/universal_tables_controller.rb +++ b/app/controllers/admin/universal_tables_controller.rb @@ -85,8 +85,8 @@ class Admin::UniversalTablesController < OrbitAdminController if !table.nil? sheet = workbook[0] if sheet.count <= 503 - columns = sheet[1].cells.collect{|c| - table.table_columns.where(:key => c.value.to_s).first rescue nil + columns = sheet[1].cells.collect.with_index{|c,i| + c.value.blank? ? table.table_columns.where(:title => sheet[0].cells[i].value.to_s.split("-").first.strip).first : table.table_columns.where(:key => c.value.to_s).first } languages = sheet[2].cells.collect{|c| c.value.split("-").last rescue nil