Skip to content

Commit

Permalink
* Fixed an SQL query in Task.total_logged_seconds to cast the res…
Browse files Browse the repository at this point in the history
…ult to plain old integer and not ``decimal.Decimal``.
  • Loading branch information
eoyilmaz committed Aug 3, 2022
1 parent a35c041 commit 8fd0061
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion stalker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import sys

__version__ = '0.2.27'
__version__ = '0.2.28'

__title__ = "stalker"
__description__ = 'A Production Asset Management (ProdAM) System'
Expand Down
2 changes: 1 addition & 1 deletion stalker/models/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand Down
3 changes: 2 additions & 1 deletion tests/db/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 8fd0061

Please sign in to comment.