developer_base = Counter({
'user1': {'XS': 0, 'S': 0, 'M': 0, 'L': 0, 'XL': 0},
'user2': {'XS': 0, 'S': 0, 'M': 0, 'L': 0, 'XL': 0},
'user3': {'XS': 0, 'S': 0, 'M': 0, 'L': 0, 'XL': 0},
'user4': {'XS': 0, 'S': 0, 'M': 0, 'L': 0, 'XL': 0},
})
Loop to gather Counter data:
for y in time_list:
story_size = models.get_specific_story(y['story_id'])
if story_size is not "?":
counts = Counter(y['minutes_spent'])
print(counts)
developer_base = developer_base + counts
Should Counter
be part of a for loop? story_size always equals one of the keys in the nested dict (S,XS,M etc). time_list
has the ['minutes_spent'] which is the value that needs to add into the dictionary. the problem seems to be that time_list has a nested dict which is ['user']['first_name'] and it is equal to the developer_base keys for user1 through user4.
So I need to add up all the 'minutes_spent' in time_list for each user.
Update: JSON data
[{'project_slug': 'test', 'project_id': 19855, 'date': '2016-02-11', 'task_name': None, 'iteration_name': 'test', 'notes': '', 'user_id': 81946, 'story_id': 392435, 'iteration_id': 76693, 'story_name': 'test', 'user': {'id': 81946, 'last_name': 'test', 'first_name': 'user1', 'email': 'test', 'username': 'test'}, 'project_name': 'Development', 'id': 38231, 'minutes_spent': 240}]
The data is much larger but this is one whole section.