From 03477d407e42ae1d6ead3398458bf0ed0e3514d3 Mon Sep 17 00:00:00 2001 From: Akshay Joshi Date: Thu, 29 Jul 2021 11:49:27 +0530 Subject: [PATCH] Fixed dashboard server activity issue when active_since parameter is None. Fixes #6650 --- docs/en_US/release_notes_5_6.rst | 1 + web/pgadmin/dashboard/__init__.py | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/docs/en_US/release_notes_5_6.rst b/docs/en_US/release_notes_5_6.rst index decbc195f..85d8570c7 100644 --- a/docs/en_US/release_notes_5_6.rst +++ b/docs/en_US/release_notes_5_6.rst @@ -26,3 +26,4 @@ Bug fixes | `Issue #6586 `_ - Fixed incorrect tablespace options in the drop-down for move objects dialog. | `Issue #6619 `_ - Fixed incorrect binary path issue when the user deletes the binary path from the preferences. | `Issue #6643 `_ - Ensure that all the required options should be loaded when the Range data type is selected while creating a custom data type. +| `Issue #6650 `_ - Fixed dashboard server activity issue when active_since parameter is None. diff --git a/web/pgadmin/dashboard/__init__.py b/web/pgadmin/dashboard/__init__.py index ae0cbf561..45497039c 100644 --- a/web/pgadmin/dashboard/__init__.py +++ b/web/pgadmin/dashboard/__init__.py @@ -365,15 +365,15 @@ def get_long_running_query_status(activities): for row in activities: row['row_type'] = None - # We care for only those queries which are in active state. - if row['state'] != 'active': - continue - - active_since = float(row['active_since']) - if active_since > warning_value: - row['row_type'] = 'warning' - if active_since > alert_value: - row['row_type'] = 'alert' + # We care for only those queries which are in active state and + # have active_since parameter and not None + if row['state'] == 'active' and 'active_since' in row and \ + row['active_since'] is not None: + active_since = float(row['active_since']) + if active_since > warning_value: + row['row_type'] = 'warning' + if active_since > alert_value: + row['row_type'] = 'alert' @blueprint.route('/dashboard_stats',