delay meeting end dates if real end time isn't set

This commit is contained in:
Frédéric Péters 2011-11-17 13:19:40 +01:00
parent 8283baf003
commit 3c8ffe20a5
1 changed files with 9 additions and 2 deletions

View File

@ -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: