summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tabellio/pcfdb/sync.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/tabellio/pcfdb/sync.py b/tabellio/pcfdb/sync.py
index cd3eb39..832572a 100644
--- a/tabellio/pcfdb/sync.py
+++ b/tabellio/pcfdb/sync.py
@@ -1025,7 +1025,7 @@ class SyncFromPcfDbView(BrowserView):
where_ts = ''
if timestamp:
where_ts = cursor.mogrify('t_reunion.ts > %s', (timestamp,))
- cursor.execute('''SELECT id, type, comid, sess, lieu, datedeb, heuredeb, datefin, heurefin,
+ cursor.execute('''SELECT id, st, type, comid, sess, lieu, datedeb, heuredeb, datefin, heurefin,
nobtr, nobtrcom, nocri, nocric, nocricom,
debreel, finreel
FROM t_reunion
@@ -1042,7 +1042,7 @@ class SyncFromPcfDbView(BrowserView):
if row is None:
break
count += 1
- reu_id, type, comid, sess, lieu, datedeb, heuredeb, datefin, \
+ reu_id, state, type, comid, sess, lieu, datedeb, heuredeb, datefin, \
heurefin, notr, nobtrcom, nocri, nocric, nocricom, \
debreel, finreel = row
@@ -1089,6 +1089,7 @@ class SyncFromPcfDbView(BrowserView):
object.place = lieu
object.session = sess
object.start = start
+
if datefin:
if heurefin:
object.end = datetime.datetime.strptime(
@@ -1100,6 +1101,12 @@ class SyncFromPcfDbView(BrowserView):
if object.end < object.start:
object.end = object.start
+ if state == 'S_OPEN' and type == 'SE' and datefin and not finreel:
+ if object.end < datetime.datetime.now():
+ # seances still open, with no real end date, but an end date
+ # that's already in the past, alter the end date.
+ object.end = object.end + datetime.timedelta(seconds=600)
+
if comid:
comid_int = self.get_commission_intid(comid)
if comid_int: