Kaynağa Gözat

feat: config-importer support empty id

LanzaSchneider 1 yıl önce
ebeveyn
işleme
b36bb1a44c
1 değiştirilmiş dosya ile 3 ekleme ve 2 silme
  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