quarantine 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ffb721a4514eda413ea4c096913b5d0c3a672b23fe6aefee44393062f202e453
4
- data.tar.gz: eec03b0ec1533643ae86245e76a69b51fdbf871e6e621293fa542b1b252fc123
3
+ metadata.gz: 3c4a41e99736f29fd49d864c842b1ecb87ac0fe514bd887176b97f13d49761cd
4
+ data.tar.gz: f36d408661b7cce88e7d4cffd0a6214ad937f452479bd8e706cdbcd03ee3d9f0
5
5
  SHA512:
6
- metadata.gz: 67f36af412a0f1b23aaa018402e81b087f9595d3257726aac3b4e6472f232a498be52d683fd6b0216f652ad3f2b702d6a5f582de70a62a8fb25fc29ec5a21df1
7
- data.tar.gz: 3aabf31b49b00cded2af25bac1b8d9f3c1c1bb89a202689a87ded5e23369fb6e4d32b82f664d3c4d3b1f314cae02f34dc80ca0a0380e6c034466e7ae8ec15300
6
+ metadata.gz: c06c78fa1741d68ebfbc1c3a88b02d30391465f532f4a4597e3625b4379924ed0852518b1d11c79ae09b0248396a579b26fce8b9cc03a8c6203bb71513c56055
7
+ data.tar.gz: 61cc08f36624613bd9a1250926216b7ea60b3847ab505881974b710035a76c22a43159e3a7735a1360d59f4f31ada5cd99c3da9eb99338bca66e5432a1726f2b
@@ -35,7 +35,8 @@ class Quarantine
35
35
  new_rows = []
36
36
 
37
37
  # Map existing ID to row index
38
- indexes = Hash[parse_rows(worksheet).each_with_index.map { |item, idx| [item['id'], idx] }]
38
+ parsed_rows = parse_rows(worksheet)
39
+ indexes = Hash[parsed_rows.each_with_index.map { |item, idx| [item['id'], idx] }]
39
40
 
40
41
  items.each do |item|
41
42
  cells = headers.map { |header| item[header].to_s }
@@ -51,7 +52,7 @@ class Quarantine
51
52
  end
52
53
 
53
54
  # Insert any items whose IDs weren't found in existing rows at the end
54
- worksheet.insert_rows(worksheet.rows.count + 1, new_rows)
55
+ worksheet.insert_rows(parsed_rows.count + 2, new_rows)
55
56
  worksheet.save
56
57
  end
57
58
 
@@ -98,9 +99,11 @@ class Quarantine
98
99
  rows.map do |row|
99
100
  hash_row = Hash[headers.zip(row)]
100
101
  # TODO: use Google Sheets developer metadata to store type information
101
- hash_row['extra_attributes'] = JSON.parse(hash_row['extra_attributes']) if hash_row['extra_attributes']
102
- hash_row
103
- end
102
+ unless hash_row['id'].empty?
103
+ hash_row['extra_attributes'] = JSON.parse(hash_row['extra_attributes']) if hash_row['extra_attributes']
104
+ hash_row
105
+ end
106
+ end.compact
104
107
  end
105
108
  end
106
109
  end
@@ -1,3 +1,3 @@
1
1
  class Quarantine
2
- VERSION = '2.1.0'.freeze
2
+ VERSION = '2.1.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quarantine
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Flexport Engineering, Eric Zhu