From 8fd00615c918bb28562a029cce979c6f1d56c55f Mon Sep 17 00:00:00 2001 From: Erkan Ozgur Yilmaz Date: Thu, 4 Aug 2022 00:07:18 +0100 Subject: [PATCH] * Fixed an SQL query in ``Task.total_logged_seconds`` to cast the result to plain old integer and not ``decimal.Decimal``. --- stalker/__init__.py | 2 +- stalker/models/task.py | 2 +- tests/db/test_db.py | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/stalker/__init__.py b/stalker/__init__.py index ae44d1d..93ed1fd 100644 --- a/stalker/__init__.py +++ b/stalker/__init__.py @@ -7,7 +7,7 @@ import sys -__version__ = '0.2.27' +__version__ = '0.2.28' __title__ = "stalker" __description__ = 'A Production Asset Management (ProdAM) System' diff --git a/stalker/models/task.py b/stalker/models/task.py index 5cc66d2..4d0a960 100644 --- a/stalker/models/task.py +++ b/stalker/models/task.py @@ -1878,7 +1878,7 @@ def _total_logged_seconds_getter(self): from sqlalchemy import text sql = """ select - extract(epoch from sum("TimeLogs".end - "TimeLogs".start)) + extract(epoch from sum("TimeLogs".end - "TimeLogs".start))::int from "TimeLogs" where "TimeLogs".task_id = :task_id """ diff --git a/tests/db/test_db.py b/tests/db/test_db.py index 6ceaab9..dc97edf 100644 --- a/tests/db/test_db.py +++ b/tests/db/test_db.py @@ -876,7 +876,8 @@ def test_alembic_version_mismatch(self): DBSession.query(User.id).all() assert "Can't reconnect until invalid transaction is rolled back. " \ - "(Background on this error at: http://sqlalche.me/e/14/8s2b)" in str(cm.value) + "(Background on this error at: " \ + "https://sqlalche.me/e/14/8s2b)" in str(cm.value) # rollback and reconnect to the database DBSession.rollback()