Last active
August 29, 2015 13:59
-
-
Save klippx/10462497 to your computer and use it in GitHub Desktop.
detect offline sync up item rows that may need to be deleted
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def detect_bad_item_rows(input) | |
ids = [] | |
input.each_with_index do |data, i| | |
if source = data["source_attributes"] | |
if rows = source["row_attributes"] | |
rows.each_with_index do |r, j| | |
if r["type"] == "ItemRow" && r["mandatory"] == false && r.keys.count == 3 | |
ids << {array_index: i, row_attributes_index: j} | |
end | |
end | |
end | |
end | |
end | |
ids | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment