diff options
author | pdp8 <pdp8@pdp8.info> | 2023-07-17 21:00:10 +0200 |
---|---|---|
committer | pdp8 <pdp8@pdp8.info> | 2023-07-17 21:00:10 +0200 |
commit | 8596528d9c0c07cc46279679f61729a3c06d902e (patch) | |
tree | 7fe1dd60cffddbe74488c360c119b87a5b125da1 /helpers.rb | |
parent | 4ca1c5555f18703d1dac673b1a77d1c919fb4787 (diff) |
client (un)follow fixed
Diffstat (limited to 'helpers.rb')
-rw-r--r-- | helpers.rb | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -83,13 +83,12 @@ helpers do json = f.read collection = JSON.parse(json) objects.each do |object| + id = object['id'] || object if delete - collection['orderedItems'].delete_if { |o| o['id'] == object['id'] } - modified = true + collection['orderedItems'].delete_if { |o| o['id'] == id or o == id } else ids = collection['orderedItems'].collect { |i| i['id'] } - collection['orderedItems'] << object unless ids.include?(object['id']) - modified = true + collection['orderedItems'] << object unless ids.include?(id) or collection['orderedItems'].include?(id) end end collection['totalItems'] = collection['orderedItems'].size |