|
@@ -470,23 +470,32 @@ def get_cache_rank_list(match_id,today):
|
|
|
group_id = item["id"]
|
|
group_id = item["id"]
|
|
|
player_total = cm.Player.objects.filter(match_id=match_id,match_group=group_id).count()
|
|
player_total = cm.Player.objects.filter(match_id=match_id,match_group=group_id).count()
|
|
|
player_post_total = cm.PlayerRecord.get_db_model(match_id).objects.filter(match_group=group_id,stock_date=today).count()
|
|
player_post_total = cm.PlayerRecord.get_db_model(match_id).objects.filter(match_group=group_id,stock_date=today).count()
|
|
|
- out_rate = (player_total-player_post_total)/float(player_total)
|
|
|
|
|
|
|
+ out_rate = (player_total-player_post_total)/float(player_total) if player_total else 0.0
|
|
|
item["players_num"] = len(players)
|
|
item["players_num"] = len(players)
|
|
|
item["win_count"] = win_count
|
|
item["win_count"] = win_count
|
|
|
item["loss_count"] = loss_count
|
|
item["loss_count"] = loss_count
|
|
|
item["players"] = new_players_sort[:3]
|
|
item["players"] = new_players_sort[:3]
|
|
|
|
|
|
|
|
|
|
|
|
|
- ntotal_income_win = float(total_income_win)/(total_income_win+total_income_lose)*10
|
|
|
|
|
- ntotal_income_lose = float(total_income_lose)/(total_income_win+total_income_lose)*10
|
|
|
|
|
|
|
+ try:
|
|
|
|
|
+ ntotal_income_win = float(total_income_win)/(total_income_win+total_income_lose)*10
|
|
|
|
|
+ ntotal_income_lose = float(total_income_lose)/(total_income_win+total_income_lose)*10
|
|
|
|
|
+ except:
|
|
|
|
|
+ ntotal_income_win = 0.0
|
|
|
|
|
+ ntotal_income_lose = 0.0
|
|
|
total_income_win = int(round(ntotal_income_win))
|
|
total_income_win = int(round(ntotal_income_win))
|
|
|
total_income_lose = int(round(ntotal_income_lose))
|
|
total_income_lose = int(round(ntotal_income_lose))
|
|
|
|
|
|
|
|
item["total_income_win"] = total_income_win
|
|
item["total_income_win"] = total_income_win
|
|
|
item["total_income_lose"] = total_income_lose
|
|
item["total_income_lose"] = total_income_lose
|
|
|
|
|
|
|
|
- ntoday_income_win = float(today_income_win)/(today_income_win+today_income_lose)*10
|
|
|
|
|
- ntoday_income_lose = float(today_income_lose)/(today_income_win+today_income_lose)*10
|
|
|
|
|
|
|
+ try:
|
|
|
|
|
+ ntoday_income_win = float(today_income_win)/(today_income_win+today_income_lose)*10
|
|
|
|
|
+ ntoday_income_lose = float(today_income_lose)/(today_income_win+today_income_lose)*10
|
|
|
|
|
+ except:
|
|
|
|
|
+ ntoday_income_win = 0.0
|
|
|
|
|
+ ntoday_income_lose = 0.0
|
|
|
|
|
+
|
|
|
today_income_win = int(round(ntoday_income_win))
|
|
today_income_win = int(round(ntoday_income_win))
|
|
|
today_income_lose = int(round(ntoday_income_lose))
|
|
today_income_lose = int(round(ntoday_income_lose))
|
|
|
|
|
|
|
@@ -3450,21 +3459,21 @@ def get_match_group_winlose_statistic(**qdata):
|
|
|
"match_group_name":match_group_dct.get(group_id),
|
|
"match_group_name":match_group_dct.get(group_id),
|
|
|
"today_fund":"{}".format(round(item["today_fund"],2)),
|
|
"today_fund":"{}".format(round(item["today_fund"],2)),
|
|
|
"today_income":"{}%".format(round(item["today_income"]*100,2)),
|
|
"today_income":"{}%".format(round(item["today_income"]*100,2)),
|
|
|
- "today_income_avg":"{}%".format(round(item["today_income"]/item["cnt"]*100,2))
|
|
|
|
|
|
|
+ "today_income_avg":"{}%".format(round(item["today_income"]/item["cnt"]*100,2)) if item["cnt"] else 0.0
|
|
|
})
|
|
})
|
|
|
group_win_lose_list = sorted(group_win_lose_list,key=lambda x:x["match_group"],reverse=True)
|
|
group_win_lose_list = sorted(group_win_lose_list,key=lambda x:x["match_group"],reverse=True)
|
|
|
|
|
|
|
|
#今日盈亏人数比
|
|
#今日盈亏人数比
|
|
|
win_cnt = prset.filter(today_income__gte=0).count()
|
|
win_cnt = prset.filter(today_income__gte=0).count()
|
|
|
lose_cnt = prset.filter(today_income__lt=0).count()
|
|
lose_cnt = prset.filter(today_income__lt=0).count()
|
|
|
- nwin_cnt = float(win_cnt)/(win_cnt+lose_cnt)*10
|
|
|
|
|
- nlose_cnt = float(lose_cnt)/(win_cnt+lose_cnt)*10
|
|
|
|
|
|
|
+ nwin_cnt = float(win_cnt)/(win_cnt+lose_cnt)*10 if (win_cnt+lose_cnt) >0 else 0.0
|
|
|
|
|
+ nlose_cnt = float(lose_cnt)/(win_cnt+lose_cnt)*10 if (win_cnt+lose_cnt) >0 else 0.0
|
|
|
win_cnt = int(round(nwin_cnt))
|
|
win_cnt = int(round(nwin_cnt))
|
|
|
lose_cnt = int(round(nlose_cnt))
|
|
lose_cnt = int(round(nlose_cnt))
|
|
|
|
|
|
|
|
#今日全部人均收益率
|
|
#今日全部人均收益率
|
|
|
total = prset.aggregate(total=Sum("today_income")).get("total")
|
|
total = prset.aggregate(total=Sum("today_income")).get("total")
|
|
|
- today_win_lose_avg = "{}%".format(round(total/prset.count()*100,2))
|
|
|
|
|
|
|
+ today_win_lose_avg = "{}%".format(round(total/prset.count()*100,2)) if prset.count()>0 else 0.0
|
|
|
|
|
|
|
|
rst = {"group_win_lose_list":group_win_lose_list,
|
|
rst = {"group_win_lose_list":group_win_lose_list,
|
|
|
"win_cnt":win_cnt,"lose_cnt":lose_cnt,
|
|
"win_cnt":win_cnt,"lose_cnt":lose_cnt,
|