The calculation of F_SOLD_PECENT is a little complicated. It is based on totals for each performance and is calculated as follows:
Calculating the initial number available
Avail = SeatsInHouse - Total Sold - Box Office Holds - Internet Holds
Calculating the number 'sold'
First, the total seats considered sold or taken includes all holds. So the base number sold is.
Sold = number sold for event + tickets held at box office _ tickets held in shopping carts
Calculating the percent available
The percent of tickets available is dependant on the values of seats available and reporting quantities. The percentage is dewtermined as follows.
- If Avail <= 0 then F_SOLD_PERCENT = 100
- if SeatsReport < SeatsInHouse then
- if SeatsReport = SeatsInHouse then
def sold_percent(self):
"""
Calculate the percentage of the performance that is sold.
:return: sold percentage for the given performance
"""
if self.pb_seats_avail = self.pb_seats_report:
# In this case, the number sold is over the reporting limit.
# We want to use that for royalties and such.
if self.total_sold >= self.pb_seats_avail:
return 100
else:
# However, if we are somewhere between PB_SEATS_REPORT and PB_SEATS_AVAIL ... then we are 99% sold
return 99
else:
return min(int(self.total_sold * 100 / self.pb_seats_report), 100)
else:
# Seats sold and available are the same, so just report on actual attendance figures
if self.total_sold >= self.pb_seats_avail:
return 100
else:
return min(int(self.total_sold * 100 / self.pb_seats_avail), 100)