From f4c476e7168a8c7224c2ff234c61d00e11870c3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Tue, 17 Jan 2012 12:15:53 +0100 Subject: [PATCH] also check timestamp from t_histoline, not just t_histo (#1224) --- tabellio/pcfdb/sync.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tabellio/pcfdb/sync.py b/tabellio/pcfdb/sync.py index 5a3a606..b05b27d 100644 --- a/tabellio/pcfdb/sync.py +++ b/tabellio/pcfdb/sync.py @@ -951,9 +951,10 @@ class SyncFromPcfDbView(BrowserView): where_ts = '' if timestamp: - where_ts = cursor.mogrify('''AND EXISTS (SELECT ts FROM t_histoline + where_ts = cursor.mogrify('''AND (EXISTS (SELECT ts FROM t_histoline WHERE idhisto = t_histo.id - AND ts > %s)''', (timestamp,)) + AND ts > %s) + OR t_histo.ts > %s)''', (timestamp, timestamp)) ### Handle t_dossiers cursor.execute('''SELECT t_histo.id, t_histo.st, t_histo.type, @@ -1023,9 +1024,10 @@ class SyncFromPcfDbView(BrowserView): ### Handle t_qx where_ts = '' if timestamp: - where_ts = cursor.mogrify('''AND EXISTS (SELECT ts FROM t_histoline + where_ts = cursor.mogrify('''AND (EXISTS (SELECT ts FROM t_histoline WHERE idhisto = t_histo.id - AND ts > %s)''', (timestamp,)) + AND ts > %s) + OR t_histo.ts > %s)''', (timestamp, timestamp)) cursor.execute('''SELECT t_histo.id, t_histo.st, t_histo.type, t_histo.sess, t_histo.no, t_histo.intit, t_histo.auteurs,