|
@@ -3733,16 +3733,20 @@ def get_user_markscore_week_avg(request):
|
|
"""
|
|
"""
|
|
"""
|
|
"""
|
|
pass
|
|
pass
|
|
- now = datetime.datetime.now().date()
|
|
|
|
|
|
+ # now = datetime.datetime.now().date()
|
|
data = []
|
|
data = []
|
|
- for i in range(1,5):
|
|
|
|
- item_list = []
|
|
|
|
- for j in range(1,8):
|
|
|
|
- now = now + datetime.timedelta(days=-1)
|
|
|
|
- now_str = ccf.datetime_to_str(now,"%Y-%m-%d")
|
|
|
|
- qset = cm.UserMarkScore.objects.filter(stock_date=now_str).aggregate(avg_score=Avg("score"))
|
|
|
|
- item_list.append({"stock_date":now_str,"avg_score":qset.get("avg_score",0)})
|
|
|
|
- data.append(item_list)
|
|
|
|
|
|
+ msret = cm.UserMarkScore.objects.all().order_by('-stock_date').values()
|
|
|
|
+ for item in msret:
|
|
|
|
+ qset = cm.UserMarkScore.objects.filter(stock_date=item['stock_date']).aggregate(avg_score=Avg("score"))
|
|
|
|
+ data.append({"stock_date":item['stock_date'],"avg_score":qset.get("avg_score",0)})
|
|
|
|
+ # for i in range(1,5):
|
|
|
|
+ # item_list = []
|
|
|
|
+ # for j in range(1,8):
|
|
|
|
+ # now = now + datetime.timedelta(days=-1)
|
|
|
|
+ # now_str = ccf.datetime_to_str(now,"%Y-%m-%d")
|
|
|
|
+ # qset = cm.UserMarkScore.objects.filter(stock_date=now_str).aggregate(avg_score=Avg("score"))
|
|
|
|
+ # item_list.append({"stock_date":now_str,"avg_score":qset.get("avg_score",0)})
|
|
|
|
+ # data.append(item_list)
|
|
|
|
|
|
return data
|
|
return data
|
|
|
|
|