diff --git a/atdb/taskdatabase/services/algorithms.py b/atdb/taskdatabase/services/algorithms.py index 3db3fa8364398018e841ed568b357db120eceac3..0e8bca9fbea6ae9057ca3b3af5967cd0b52f7a5d 100644 --- a/atdb/taskdatabase/services/algorithms.py +++ b/atdb/taskdatabase/services/algorithms.py @@ -4,6 +4,7 @@ Description: Business logic for ATDB. These functions are called from the views (views.py). """ +from datetime import datetime, timedelta from django.db.models import Q, Sum import logging from .common import timeit @@ -261,7 +262,14 @@ def convert_monitor_to_html(request, monitor_data): line += "<td><b>" + link_to_service_history + "</b></td>" line += "<td>" + str(record.hostname) + "</td>" line += '<td class="' + record.status + '" >' + str(record.status) + "</td>" - line += "<td>" + str(record.timestamp) + "</td>" + + d1 = datetime.utcnow().replace(tzinfo=None) + d2 = record.timestamp.replace(tzinfo=None) + delta = d1 - d2 + if delta.seconds > 60: + line += '<td class="error">' + str(record.timestamp.strftime(TIME_FORMAT)) + " - (late)</td>" + else: + line += '<td>' + str(record.timestamp) + "</td>" line += "<td>" + str(record.process_id) + "</td>" line += "<td>" + str(record.description) + "</td>" line += "</tr>"