Prechádzať zdrojové kódy

feat: config-importer support empty id

LanzaSchneider 1 rok pred
rodič
commit
b36bb1a44c
1 zmenil súbory, kde vykonal 3 pridanie a 2 odobranie
  1. 3 2
      editor/tools/config-importer.rb

+ 3 - 2
editor/tools/config-importer.rb

@@ -62,13 +62,14 @@ Dir["#{config_path}/*"].each do |path|
       table.fields << field
     end
     # 验证 Id 列
-    next if field_id.nil?
     table.id_field = field_id
     # 处理条目形成引用表
     while !csv.eof?
       line = csv.readline
       next if field_id_name.nil?
-      table.name2id[line[field_id_name.column_id]] = line[field_id.column_id].upcase
+      id = line[field_id.column_id]
+      next if id.nil? || id.empty?
+      table.name2id[line[field_id_name.column_id]] = id.upcase
     end
     # 回滚 csv 状态至表头读取后
     csv.rewind