summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2012-07-09 08:15:28 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2012-07-09 08:15:28 (GMT)
commit507e8cb4d5cfa7f63fb5b05852c539218878dc9a (patch)
tree8ce91977550003407b0e0b8e50fbdd4eae519fa4
parent186c5734e64aa5bd4619bb374444c39c6e11fbc6 (diff)
downloadtabellio.pcfdb-507e8cb4d5cfa7f63fb5b05852c539218878dc9a.zip
tabellio.pcfdb-507e8cb4d5cfa7f63fb5b05852c539218878dc9a.tar.gz
tabellio.pcfdb-507e8cb4d5cfa7f63fb5b05852c539218878dc9a.tar.bz2
get written question date from t_qe table (#1388)
-rw-r--r--tabellio/pcfdb/sync.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/tabellio/pcfdb/sync.py b/tabellio/pcfdb/sync.py
index d2071fb..820a56f 100644
--- a/tabellio/pcfdb/sync.py
+++ b/tabellio/pcfdb/sync.py
@@ -1087,7 +1087,7 @@ class SyncFromPcfDbView(BrowserView):
cursor.execute('''SELECT t_histo.id, t_histo.st, t_histo.type, t_histo.sess,
t_histo.no, t_histo.intit, t_histo.auteurs,
- t_histo.comppols, t_histo.matiereids
+ t_histo.comppols, t_histo.matiereids, t_histo.objid
FROM t_histo
WHERE t_histo.intit IS NOT NULL
AND t_histo.type IN ('QA', 'QE', 'QO', 'INTERP')
@@ -1099,7 +1099,7 @@ class SyncFromPcfDbView(BrowserView):
if row is None:
break
count += 1
- dos_id, state, dostype, sess, no, intit, authors, polgroups, topics = row
+ dos_id, state, dostype, sess, no, intit, authors, polgroups, topics, objid = row
log.debug('t_qx/dos id: %s', dos_id)
if intit and '\n' in intit:
@@ -1137,6 +1137,18 @@ class SyncFromPcfDbView(BrowserView):
if object.histolines:
object.date = object.histolines[0].date
+ if object.questype == 'QE':
+ # query into t_qe to get the question date instead of the bqr
+ # date
+ qe_cursor = self.db_connection.cursor()
+ qe_cursor.execute('''SELECT date
+ FROM t_qe
+ WHERE id = %s''', (objid,))
+ row = qe_cursor.fetchone()
+ if row is not None:
+ object.date = row[0]
+ qe_cursor.close()
+
notify(ObjectModifiedEvent(object))
self.publish(object)