From 850b3a521139bd5a8eb75b4d3a499b0eead88b13 Mon Sep 17 00:00:00 2001 From: Josh Washburne Date: Wed, 28 Mar 2018 12:40:17 -0400 Subject: [PATCH] Functions in utils.py relocated. File no longer necessary. --- savepointradio/radio/utils.py | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 savepointradio/radio/utils.py diff --git a/savepointradio/radio/utils.py b/savepointradio/radio/utils.py deleted file mode 100644 index 40d1ac1..0000000 --- a/savepointradio/radio/utils.py +++ /dev/null @@ -1,25 +0,0 @@ -from datetime import timedelta -from decimal import * -from random import randint - -from django.db import models -from django.utils import timezone - - -# Set decimal precision -getcontext().prec = 16 - - -def get_wait_until_next_play(song): - """ - Length of time in seconds before a song can be played again. - """ - if not song.last_played: - return Decimal('0.00') - - wait = song.music.wait_total() - nextplay = song.last_played + timedelta(seconds=float(wait)) - current = (nextplay - timezone.now()).total_seconds() - - return Decimal(current if current > 0 else 0).quantize(Decimal('.01'), - rounding=ROUND_UP)