Skip to content

Commit

Permalink
Merge pull request #374 from Crunch-io/issue-373
Browse files Browse the repository at this point in the history
when creating a variable with create_variable() and passing subvariab…
  • Loading branch information
xbito authored Sep 15, 2019
2 parents 705281a + aeb1162 commit 182c069
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions scrunch/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1703,9 +1703,12 @@ def create_variable(self, var_type, name, alias=None, description='',
if categories:
payload['categories'] = categories
if subvariables:
payload['subreferences'] = [
{'name': item['name']} for item in subvariables
]
payload['subreferences'] = []
for item in subvariables:
subrefs = {'name': item['name']}
if item.get('alias'):
subrefs['alias'] = item['alias']
payload['subreferences'].append(subrefs)
if values:
payload['values'] = values

Expand Down

0 comments on commit 182c069

Please sign in to comment.