Skip to content

Instantly share code, notes, and snippets.

@klippx
Last active August 29, 2015 13:59
Show Gist options
  • Save klippx/10462497 to your computer and use it in GitHub Desktop.
Save klippx/10462497 to your computer and use it in GitHub Desktop.
detect offline sync up item rows that may need to be deleted
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