def over_or_under_compute_(self): for r in self: ratio_over, over_amount = handicap_winning_(None, bet_kind='over', mode='predict', match_id=r) r.over_wl = ratio_over r.under_wl = -ratio_over r.over_0_05_1 = abs(ratio_over) if ratio_over > 0: r.over_or_under = 'over' ratio_under, under_amount = handicap_winning_(None, bet_kind='under', mode='predict', match_id=r) r.ou_win_amount = over_amount r.ou_lost_amount = under_amount elif ratio_over < 0: r.over_or_under = 'under' ratio_under, under_amount = handicap_winning_(None, bet_kind='under', mode='predict', match_id=r) r.ou_win_amount = under_amount r.ou_lost_amount = over_amount else: r.over_or_under = 'draw' under_amount = 0 r.over_wl_amount = over_amount r.under_wl_amount = under_amount
def predict_exact_score_winning_amount_(self): for r in self: bet_kind = 'exact_score' winning_ratio, winning_amount = handicap_winning_(r, bet_kind, mode='predict') r.predict_exact_score_winning_amount = winning_amount
def predict_handicap_winning_mount_(self): for r in self: # r.handicap = r.match_id.begin_handicap bet_kind = r.predict_handicap winning_ratio, winning_amount = handicap_winning_(r, bet_kind, mode='predict') r.predict_handicap_winning_mount = winning_amount
def handicap_wl_compute_(self): for r in self: if r.state != u'Chưa bắt đầu': ratio, amount = handicap_winning_(None, bet_kind='handicap1', mode='predict', match_id=r) r.handicap_wl1 = ratio r.handicap_wl2 = -ratio r.handicap_0_05_1 = abs(ratio) if ratio > 0: doi_thang = 'team1' r.handicap_bet_winner = 'team1' r.handicap_bet_loser = 'team2' r.handicap_win_amount = amount ratio_handicap_lost, handicap_lost_amount = handicap_winning_( None, bet_kind='handicap2', mode='predict', match_id=r) r.handicap_lost_amount = handicap_lost_amount r.handicap_wl_amount1 = amount r.handicap_wl_amount2 = handicap_lost_amount elif ratio < 0: doi_thang = 'team2' r.handicap_bet_winner = 'team2' r.handicap_bet_loser = 'team1' ratio_handicap_win, handicap_win_amount = handicap_winning_( None, bet_kind='handicap2', mode='predict', match_id=r) r.handicap_lost_amount = amount r.handicap_win_amount = handicap_win_amount r.handicap_wl_amount1 = amount r.handicap_wl_amount2 = handicap_win_amount else: doi_thang = 'hoa_tien' r.handicap_bet_winner = 'hoa' r.handicap_bet_loser = 'hoa' adict = {} if r.begin_handicap > 0: adict = {'team1': 'cua_tren', 'team2': 'cua_duoi'} elif r.begin_handicap < 0: adict = {'team2': 'cua_tren', 'team1': 'cua_duoi'} rs = adict.get(doi_thang, doi_thang) r.cua_tren_hay_cua_duoi = rs
def predict_handicap_winning_mount_(self): for r in self: bet_kind = r.predict_handicap winning_ratio,winning_amount = handicap_winning_(r,bet_kind,mode='predict') r.predict_handicap_winning_mount = winning_amount