history - travis tests fix

This commit is contained in:
ingvar1995 2017-03-04 23:18:26 +03:00
parent 019165aeac
commit 8bbefff6c7
1 changed files with 3 additions and 1 deletions

View File

@ -135,11 +135,13 @@ class History:
db.close() db.close()
def delete_message(self, tox_id, time): def delete_message(self, tox_id, time):
start, end = str(time - 0.01), str(time + 0.01)
chdir(settings.ProfileHelper.get_path()) chdir(settings.ProfileHelper.get_path())
db = connect(self._name + '.hstr', timeout=TIMEOUT) db = connect(self._name + '.hstr', timeout=TIMEOUT)
try: try:
cursor = db.cursor() cursor = db.cursor()
cursor.execute('DELETE FROM id' + tox_id + ' WHERE unix_time = ' + str(time) + ';') cursor.execute('DELETE FROM id' + tox_id + ' WHERE unix_time < ' + end + ' AND unix_time > ' +
start + ';')
db.commit() db.commit()
except: except:
print('Database is locked!') print('Database is locked!')