.map(m => ( <Bet key={m.name} {...m} bets={eliteBets.filter(b => b.match === m.name)} home_team={teams[m.home_team - 1]} away_team={teams[m.away_team - 1]} odd={getOdd(m, allOdds)} onBet={async (props) => { const response = await eliteBet({ slackid, slacktoken, match: m.name, team: props.team.id, amount: +props.value }) await refetch() return response }} /> ))}
const getResults = (_, team, match, finished, odds, type) => { const bets = _.filter(b => b.team === team.id) const bet = bets[0] || {} const correct = finished && correctBet(bet, match) const wrong = bet.id && finished && !correct const odd = getOdd(match, odds)[type] const amount = bets.reduce((sum, b) => sum + b.amount, 0) return { correct, wrong, amount, adjustedAmount: correct ? odd * amount : amount } }