diff options
Diffstat (limited to 'dash')
-rw-r--r-- | dash/pages/total.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/dash/pages/total.py b/dash/pages/total.py index 130c7f2..9655c51 100644 --- a/dash/pages/total.py +++ b/dash/pages/total.py @@ -271,7 +271,7 @@ def make_sums(rangeStart, rangeEnd, satellites): if len(satellites) > 0: formatStrings = ','.join(['%s'] * len(satellites)) - cursor.execute(stmt + ' AND r.ip IN ({})'.format(formatStrings), tuple([days, rangeStart, rangeEnd] + satellites)) + cursor.execute(stmt + ' AND r.ip IN ({})'.format(formatStrings), tuple([rangeStart, rangeEnd] + satellites)) else: cursor.execute(stmt, (rangeStart, rangeEnd)) @@ -279,12 +279,19 @@ def make_sums(rangeStart, rangeEnd, satellites): db.closeConnection(dbcon) - strTimes = 'Total Time: {}h Total Session Time: {}h Total Off Time: {}h'.format( - int(data['totalTime'] / 3600), - int(data['totalSessionTime'] / 3600), - int(data['totalOffTime'] / 3600) - ) - strSessions = 'Total Short Sessions: {} Total Long Sessions: {}'.format(data['shortSessions'], data['longSessions']) + try: + strTimes = 'Total Time: {}h Total Session Time: {}h Total Off Time: {}h'.format( + int(data['totalTime'] / 3600), + int(data['totalSessionTime'] / 3600), + int(data['totalOffTime'] / 3600) + ) + except: + strTimes = "No Data available!" + + try: + strSessions = 'Total Short Sessions: {} Total Long Sessions: {}'.format(data['shortSessions'], data['longSessions']) + except: + strSessions = "No Data available!" return strTimes, strSessions |