2017-02-10 21:02:07 +01:00
|
|
|
from datetime import datetime
|
2017-02-05 17:07:42 +01:00
|
|
|
|
|
|
|
|
2017-02-06 21:25:45 +01:00
|
|
|
def get_prize_for(start, end, pph=0):
|
2017-02-05 17:18:37 +01:00
|
|
|
"""
|
2017-02-05 17:07:42 +01:00
|
|
|
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
|
2017-02-05 17:18:37 +01:00
|
|
|
"""
|
2017-02-05 17:07:42 +01:00
|
|
|
pps = pph / 3600
|
|
|
|
time = (end - start).seconds
|
|
|
|
prize = round((pps * time), 1)
|
|
|
|
return prize
|