Commit 93aa9f634837b67b361d11061d43f46e27c3423d

Authored by Felipe Bormann
1 parent 227f6cf7

modified to solve weekly chart problem

Showing 1 changed file with 4 additions and 1 deletions   Show diff stats
analytics/views.py
... ... @@ -73,7 +73,8 @@ def most_active_users_in_a_month(request):
73 73  
74 74  
75 75 def activity_in_timestamp(days, **kwargs):
76   - data = {}
  76 + data = OrderedDict()
  77 +
77 78 params = kwargs.get('params')
78 79 for day in days:
79 80 if params.get('category_id'):
... ... @@ -198,8 +199,10 @@ def get_days_of_the_week_log(request):
198 199 date = datetime.strptime( date, '%m/%d/%Y')
199 200 days = get_days_of_the_week(date)
200 201 data = activity_in_timestamp(days, params = params)
  202 + print(data)
201 203 #mapping of number to days
202 204 mapping = {0: _("Mon"), 1: _("Tue"), 2: _("Wed"), 3: _("Thu"), 4: _("Fri"), 5: _("Sat"), 6: _("Sun")}
  205 + #datas = [{"day": day.weekday(), "count": day_count} for day, day_count in data.items()]
203 206 data = [{"day": mapping[day.weekday()], "count": day_count} for day, day_count in data.items()]
204 207  
205 208 return JsonResponse(data, safe= False)
... ...