Skip to content

Commit

Permalink
[#800] Classifications not Classification
Browse files Browse the repository at this point in the history
  • Loading branch information
Bjwebb committed Aug 9, 2017
1 parent ae6bbe2 commit 2193ca7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions cove_360/lib/threesixtygiving.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,13 +556,13 @@ def process(self, grant, path_prefix):

class NoClassificationTitle(AdditionalTest):
def process(self, grant, path_prefix):
classification_title = grant.get("classification") and grant.get("classification").get('title')
if not classification_title:
classifications_title = grant.get("classifications") and any(classification.get('title') for classification in grant.get("classifications"))
if not classifications_title:
self.failed = True
self.count += 1
self.json_locations.append(path_prefix + '/id')

self.heading = self.format_heading_count("not have a Classification: Title field", verb='do')
self.heading = self.format_heading_count("not have a Classifications: Title field", verb='do')
self.message = "This field allows you to describe how you classify the grant or have tagged it internally. Examples include classifying by sector (eg Healthcare) or target group (eg NEET)."


Expand Down
8 changes: 5 additions & 3 deletions cove_360/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
'companyNumber': 'AAA',
'id': '360G-Blah',
'name': 'Animate Project Limited'}],
'classifications': [{
'title': 'Classification title'}],
'title': 'Silent Signal. ,moo@moo.com '},
{'Co-applicant(s)': ' ',
'Department': 'Department of Museum Studies',
Expand Down Expand Up @@ -419,11 +421,11 @@
'message': "Knowing where information came from is an important part of establishing trust in your data."},
['grants/0/id', 'grants/2/id'],
[['grants', 'A', 2, 'Identifier'], ['grants', 'A', 4, 'Identifier']]),
({'heading': "3 grants do not have a Classification: Title field",
({'heading': "2 grants do not have a Classifications: Title field",
'message': ("This field allows you to describe how you classify the grant or have tagged it internally. "
"Examples include classifying by sector (eg Healthcare) or target group (eg NEET).")},
['grants/0/id', 'grants/1/id', 'grants/2/id'],
[['grants', 'A', 2, 'Identifier'], ['grants', 'A', 3, 'Identifier'], ['grants', 'A', 4, 'Identifier']])
['grants/1/id', 'grants/2/id'],
[['grants', 'A', 3, 'Identifier'], ['grants', 'A', 4, 'Identifier']])
]


Expand Down

0 comments on commit 2193ca7

Please sign in to comment.