carom-server/billard/utils.py
2017-02-11 10:53:46 +01:00

17 lines
404 B
Python

from datetime import datetime
def get_prize_for(start, end, pph=0):
"""
calculate prize of billard table rental
:param start: start datetime of rental
:param end: end datetime of rental
:param pph: prize per hour of rental
:return: the calculated prize of rental
"""
pps = pph / 3600
time = (end - start).seconds
prize = round((pps * time), 1)
return prize