Skip to content

Commit

Permalink
Tidy up csv parsing for groups
Browse files Browse the repository at this point in the history
  • Loading branch information
huwd committed Nov 13, 2019
1 parent 98ce7c3 commit fe4911b
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions lib/brexit_checker/convert_csv_to_yaml/actions_processor.rb
Expand Up @@ -23,7 +23,7 @@ def process(record)
stripped_record = parse_logic_fields(stripped_record)
stripped_record = strip_trailing_whitespace(stripped_record)
stripped_record = remove_empty_fields(stripped_record)
stripped_record = parse_grouping(stripped_record)
stripped_record["result_groups"] &&= stripped_record["result_groups"].split(",").map(&:strip)
stripped_record["priority"] = stripped_record["priority"].to_i
stripped_record
end
Expand All @@ -36,12 +36,6 @@ def parse_logic_fields(record)
end
end

def parse_grouping(record)
group_criteria = record["result_groups"]
record["result_groups"] = group_criteria.split(",").map(&:strip) unless group_criteria.nil?
record
end

def remove_unnecessary_fields(record)
record.keep_if { |k, _v| ALLOWED_FIELDS.include?(k) }
end
Expand Down

0 comments on commit fe4911b

Please sign in to comment.