Skip to content

Commit

Permalink
Rui added some smart code to get a list of actions in order each time
Browse files Browse the repository at this point in the history
  • Loading branch information
bsgreenb committed Jan 28, 2012
1 parent 263b40a commit 9e6acb3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions todo.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
action_type_list
sharers_list




#TODO
- why force url format is not working for change_redirect_link's redirect_link
- planout the sorting
Expand Down
8 changes: 5 additions & 3 deletions wordout/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,14 @@ def sharers_by_action_count_with_total_clicks():
'redirect_link': redirect_link,
'enabled': sharer.enabled,
'click_total': sharer.click_total,
'action_type_set': {action_type.action_name: 0 for action_type in action_type_ls} #we have to pass it a dictionary literal each time cus python is ornery about this
'action_type_set': [{action_type_id=action_type.id, action_name=action_type.action_name, action_total= 0} for action_type in action_type_ls] #we have to pass it a dictionary literal each time cus python is ornery about this
}

for sharer_action_count in sharer_action_counts:
if sharer_action_count['click__sharer_id'] == sharer.id:
sharer_dict['action_type_set'][sharer_action_count['action_type__action_name']] = sharer_action_count['action_total']
if sharer_action_count['click__sharer_id'] == sharer.id: #We've matched the sharer's action count row to their total_click and other info row.
for action_type in sharer_dict['action_type_set']:
if action_type['action_type_id'] == sharer_action_count['action_type_id']:
action_type['action_total'] = sharer_action_count['action_total']

results.append(sharer_dict)

Expand Down

0 comments on commit 9e6acb3

Please sign in to comment.