From 843c764aa8b1b813e73b419ef219687789d8b2ae Mon Sep 17 00:00:00 2001 From: Alan Hamlett Date: Tue, 25 Aug 2015 11:17:52 -0700 Subject: [PATCH] fix bug in offline logging causing heartbeats to never get cleared --- HISTORY.rst | 1 - wakatime/offlinequeue.py | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 7860d5d..4312fe7 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -432,4 +432,3 @@ History ++++++++++++++++++ - Birth - diff --git a/wakatime/offlinequeue.py b/wakatime/offlinequeue.py index ab05189..3ef3d30 100644 --- a/wakatime/offlinequeue.py +++ b/wakatime/offlinequeue.py @@ -61,7 +61,7 @@ class Queue(object): 'misc': u(misc), 'plugin': u(plugin), } - c.execute(u('INSERT INTO heartbeat VALUES (:file,:time,:project,:branch,:is_write,:stats,:misc,:plugin)'), heartbeat) + c.execute('INSERT INTO heartbeat VALUES (:file,:time,:project,:branch,:is_write,:stats,:misc,:plugin)', heartbeat) conn.commit() conn.close() except sqlite3.Error: @@ -92,14 +92,14 @@ class Queue(object): for row_name in ['file', 'time', 'project', 'branch', 'is_write']: if row[index] is not None: clauses.append('{0}=?'.format(row_name)) - values.append(u(row[index])) + values.append(row[index]) else: clauses.append('{0} IS NULL'.format(row_name)) index += 1 if len(values) > 0: - c.execute(u('DELETE FROM heartbeat WHERE {0}').format(u(' AND ').join(clauses)), values) + c.execute('DELETE FROM heartbeat WHERE {0}'.format(' AND '.join(clauses)), values) else: - c.execute(u('DELETE FROM heartbeat WHERE {0}').format(u(' AND ').join(clauses))) + c.execute('DELETE FROM heartbeat WHERE {0}'.format(' AND '.join(clauses))) conn.commit() if row is not None: heartbeat = {