tallty_import_export 1.0.16 → 1.0.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a10f7b098cd3e2d58f203bda043ac3ab1fb49f0a846c85c84aeed261ecfab16
4
- data.tar.gz: 23bfd18fc032beae0ca7274c467cae73d28bed1c45f02037c9293a5e12945eab
3
+ metadata.gz: 9253a9c6be1b5829d258f8a3c7cf59729e84d1e8c8daeba7890fb050fe61708c
4
+ data.tar.gz: 7c3e2b5ba2c20149f47f0d19b26710d5e722ed946b483e4e78dcd1a9c1b00247
5
5
  SHA512:
6
- metadata.gz: 8a02d6d4643a5b473afab17d86c21791bea8c3c040b06bcb04bfdd7d9f8afe8d40bbed12ca3d514201e44b480c5be6a5e5aa663f4619e196863c16de74f424d0
7
- data.tar.gz: fca02d7bf9dd5811938cc7130e7170c004aad4544157dda71793a60e00e994ec02b56cf250819bd2582c4d5d25b1b482550282097facd3514ddbae1fde2521ed
6
+ metadata.gz: dbb47e4a94cd7b7c3fe059aa5f0fc3d0384b023360452e62ab37dc4c524a8f5258e3827e6bded58a8931f36ce569d079f02424578e48a1f9c9281a6dbc7ad001
7
+ data.tar.gz: 7101fb1b0ef57e7ea7983e949e7a4b88dc986fd382061da954609755b94efa3a4b26d4a23049ef146444c823ed81f52d8ded585460dc91b7ecfde858d0fcce36
@@ -179,9 +179,9 @@ module TalltyImportExport
179
179
  when 'string'
180
180
  data.to_s
181
181
  when 'datetime'
182
- data ? data.strftime('%F %H:%M') : nil
182
+ data ? data.in_time_zone.strftime('%F %H:%M') : nil
183
183
  when 'date'
184
- data ? data.strftime('%F') : nil
184
+ data ? data.in_time_zone.strftime('%F') : nil
185
185
  else
186
186
  data
187
187
  end
@@ -65,6 +65,8 @@ module TalltyImportExport
65
65
  end
66
66
 
67
67
  def process_line_info line_info, associations
68
+ # 去除空行内容
69
+ return unless line_info.values.any?(&:present?)
68
70
  # 转换处理导入的数据格式
69
71
  line_info = convert_data(line_info)
70
72
 
@@ -77,7 +79,7 @@ module TalltyImportExport
77
79
 
78
80
  def convert_data line_info
79
81
  line_info.with_indifferent_access.reduce({}) do |h, (k, v)|
80
- header = @headers.find do |_header|
82
+ header = import_headers_result.find do |_header|
81
83
  _header[:key].to_sym == k.to_sym
82
84
  end
83
85
  # header[:convert] = handle_xxx
@@ -88,8 +90,7 @@ module TalltyImportExport
88
90
  h[header[:json]][k] = val
89
91
  elsif header[:finder]
90
92
  $SAFE = 2
91
- eval_string = header[:finder] + '(val)'
92
- eval eval_string
93
+ h[k.to_sym] = eval header[:finder]
93
94
  else
94
95
  h[k.to_sym] = val
95
96
  end
@@ -103,7 +104,7 @@ module TalltyImportExport
103
104
  end
104
105
 
105
106
  def import_headers_result
106
- @headers || import_headers
107
+ @headers ||= import_headers
107
108
  end
108
109
 
109
110
  def import_headers **args
@@ -1,3 +1,3 @@
1
1
  module TalltyImportExport
2
- VERSION = "1.0.16"
2
+ VERSION = "1.0.21"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tallty_import_export
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.16
4
+ version: 1.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - liyijie
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-18 00:00:00.000000000 Z
11
+ date: 2021-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zip-zip