Skip to content

Commit

Permalink
OpenConceptLab/ocl_issues#957 | importers | using pop more
Browse files Browse the repository at this point in the history
  • Loading branch information
snyaggarwal committed Dec 30, 2023
1 parent b17acc0 commit 10e916e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/importers/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,17 +854,17 @@ def make_resource_distribution(self):
for line in self.input_list:
data = line if isinstance(line, dict) else json.loads(line)
data_type = data.get('type', None)
if not data_type:
if not data_type or data_type.lower() not in ['organization', 'source', 'collection']:
continue
if data_type not in self.resource_distribution:
self.resource_distribution[data_type] = []
self.resource_distribution[data_type].append(data)

def make_parts(self):
prev_line = None
orgs = self.resource_distribution.get('Organization', None)
sources = self.resource_distribution.get('Source', None)
collections = self.resource_distribution.get('Collection', None)
orgs = self.resource_distribution.pop('Organization', None)
sources = self.resource_distribution.pop('Source', None)
collections = self.resource_distribution.pop('Collection', None)
if orgs:
self.parts = deque([orgs])
if sources:
Expand Down

0 comments on commit 10e916e

Please sign in to comment.