Skip to content

Commit

Permalink
[#1117] Move validation error grouping into its own function
Browse files Browse the repository at this point in the history
  • Loading branch information
Bjwebb authored and robredpath committed Jun 7, 2019
1 parent c3edf9c commit 2c9178d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions cove_360/lib/threesixtygiving.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,7 @@ def get_grants_aggregates(json_data):
}


def common_checks_360(context, upload_dir, json_data, schema_obj):
schema_name = schema_obj.release_pkg_schema_name
common_checks = common_checks_context(upload_dir, json_data, schema_obj, schema_name, context)
cell_source_map = common_checks['cell_source_map']

validation_errors = context['validation_errors']
def group_validation_errors(validation_errors):
validation_errors_grouped = defaultdict(list)
for error_json, values in validation_errors:
error = json.loads(error_json)
Expand All @@ -121,6 +116,13 @@ def common_checks_360(context, upload_dir, json_data, schema_obj):
validation_errors_grouped['format'].append((error_json, values))
else:
validation_errors_grouped['other'].append((error_json, values))
return validation_errors_grouped


def common_checks_360(context, upload_dir, json_data, schema_obj):
schema_name = schema_obj.release_pkg_schema_name
common_checks = common_checks_context(upload_dir, json_data, schema_obj, schema_name, context)
cell_source_map = common_checks['cell_source_map']

context.update(common_checks['context'])
context.update({
Expand Down

0 comments on commit 2c9178d

Please sign in to comment.