Skip to content

Commit

Permalink
allow Item_ID to be null in C5 data
Browse files Browse the repository at this point in the history
  • Loading branch information
beda42 committed Mar 15, 2021
1 parent 3939cd6 commit e13403b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion apps/nigiri/counter5.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ def read_report(self, report: dict) -> [CounterRecord]:
record = CounterRecord()
record.platform_name = item.get('Platform')
record.title = self._item_get_title(item)
record.title_ids = self._extract_title_ids(item.get('Item_ID', []))
# Item_ID can (should not, but can) be null, so we use get() or [] to handle it
record.title_ids = self._extract_title_ids(item.get('Item_ID') or [])
record.dimension_data = self._extract_dimension_data(self.dimensions, item)
performances = item.get('Performance')
for performance in performances:
Expand Down
2 changes: 1 addition & 1 deletion apps/sushi/management/commands/validate_sushi_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def handle(self, *args, **options):
def item_to_key(cls, item):
key_keys = ['Title', 'Platform']
item_key = [item.get(key) for key in key_keys]
item_ids = item.get('Item_ID', [])
item_ids = item.get('Item_ID') or []
for key in Counter5TRReport.allowed_item_ids:
for item_id in item_ids:
if item_id.get('Type') == key:
Expand Down

0 comments on commit e13403b

Please sign in to comment.