currentSystemStats = (attendees, avgTicket, npExpenses, musicians) => {
const income = attendees * avgTicket
const afterNpExpenses = income - npExpenses
const callerGuarantee = PERFORMER_GUARANTEE
const musicianGuarantee = musicians <= MUSICIAN_LIMIT ? PERFORMER_GUARANTEE: PERFORMER_GUARANTEE * MUSICIAN_LIMIT / musicians
const rawProfit = afterNpExpenses - callerGuarantee - musicianGuarantee * musicians
const bida100 = Math.max(Math.min(100, rawProfit), 0)
const profitToSplit = Math.max(rawProfit - bida100, 0)
const performerProfit = profitToSplit / 2
const performerProfitPer = Math.floor(performerProfit / (musicians + 1))
const musicianPay = musicianGuarantee + performerProfitPer
const callerPay = callerGuarantee + performerProfitPer
const bidaProfit = afterNpExpenses - musicianPay * musicians - callerPay
return {
attendees,
musicians,
income,
musicianPay,
callerPay,
bidaProfit,
system: 'current',
}
}