Skip to content

Commit

Permalink
Fixed a bug where the last process time could be set in a weird way
Browse files Browse the repository at this point in the history
  • Loading branch information
kmteras committed Jul 16, 2019
1 parent 8b5b49d commit 015b971
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions timechart/core/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,13 @@ def add_heartbeat(heartbeat: ProcessHeartbeat) -> None:
query = QtSql.QSqlQuery()
query.prepare(
"UPDATE heartbeats "
"SET end_time=:start_time "
"SET end_time=:end_time "
"WHERE start_time=:last_start_time")

limited_end_time = min(int(last_end_time) + Settings().heartbeat_time, end_time)

query.bindValue(":last_start_time", last_start_time)
query.bindValue(":start_time", end_time)
query.bindValue(":end_time", limited_end_time)
if not query.exec_():
raise DatabaseError(query.lastError())

Expand Down

0 comments on commit 015b971

Please sign in to comment.