FIX: dav_events: expire flag was stamped at last day not after last day.
This commit is contained in:
1
TODO.txt
1
TODO.txt
@@ -1,4 +1,3 @@
|
|||||||
- FIX: timestamp of automagically detected expire status
|
|
||||||
- FIX: validation for first_day
|
- FIX: validation for first_day
|
||||||
|
|
||||||
- Test event list export
|
- Test event list export
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ from .roles import get_users_by_role, has_role
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
today = datetime.date.today()
|
today = datetime.date.today()
|
||||||
|
midnight = datetime.time(00, 00, 00)
|
||||||
|
oneday = datetime.timedelta(1)
|
||||||
|
|
||||||
DEFAULT_EVENT_STATI = {
|
DEFAULT_EVENT_STATI = {
|
||||||
'void': (0, _(u'Ungültig'), None),
|
'void': (0, _(u'Ungültig'), None),
|
||||||
@@ -56,8 +58,6 @@ class BasicWorkflow(object):
|
|||||||
if not event.id:
|
if not event.id:
|
||||||
return
|
return
|
||||||
|
|
||||||
midnight = datetime.time(00, 00, 00)
|
|
||||||
|
|
||||||
if code in (None, 'draft'):
|
if code in (None, 'draft'):
|
||||||
# Check if event has a draft flag.
|
# Check if event has a draft flag.
|
||||||
if not event.flags.filter(status__code='draft').exists():
|
if not event.flags.filter(status__code='draft').exists():
|
||||||
@@ -97,9 +97,10 @@ class BasicWorkflow(object):
|
|||||||
published_facebook = pub_flags.filter(status__code='published_facebook')
|
published_facebook = pub_flags.filter(status__code='published_facebook')
|
||||||
|
|
||||||
if not event.planned_publication_date or event.planned_publication_date <= today:
|
if not event.planned_publication_date or event.planned_publication_date <= today:
|
||||||
# Event is due to be published.
|
# Event should be published now, so we can set the flag.
|
||||||
|
|
||||||
# Timestamp of the detected action flag. No very good. TODO
|
# Event has a planned publication date, so this should be the
|
||||||
|
# time, were the event could be flagged as published.
|
||||||
if event.planned_publication_date:
|
if event.planned_publication_date:
|
||||||
timestamp = timezone.make_aware(datetime.datetime.combine(
|
timestamp = timezone.make_aware(datetime.datetime.combine(
|
||||||
event.planned_publication_date,
|
event.planned_publication_date,
|
||||||
@@ -109,7 +110,7 @@ class BasicWorkflow(object):
|
|||||||
timestamp = None
|
timestamp = None
|
||||||
|
|
||||||
if event.flags.filter(status__code='publishing').exists():
|
if event.flags.filter(status__code='publishing').exists():
|
||||||
# The publishers have confirmed the publications date,
|
# The publishers have confirmed the (now elapsed) publications date,
|
||||||
# so we can flag the complete publication.
|
# so we can flag the complete publication.
|
||||||
if not timestamp:
|
if not timestamp:
|
||||||
timestamp = event.flags.filter(status__code='publishing').last().timestamp
|
timestamp = event.flags.filter(status__code='publishing').last().timestamp
|
||||||
@@ -161,15 +162,15 @@ class BasicWorkflow(object):
|
|||||||
|
|
||||||
if event.alt_last_day:
|
if event.alt_last_day:
|
||||||
if event.alt_last_day < today:
|
if event.alt_last_day < today:
|
||||||
expired_at = event.alt_last_day
|
expired_at = event.alt_last_day + oneday
|
||||||
elif event.last_day:
|
elif event.last_day:
|
||||||
if event.last_day < today:
|
if event.last_day < today:
|
||||||
expired_at = event.last_day
|
expired_at = event.last_day + oneday
|
||||||
elif event.alt_first_day:
|
elif event.alt_first_day:
|
||||||
if event.alt_first_day < today:
|
if event.alt_first_day < today:
|
||||||
expired_at = event.alt_first_day
|
expired_at = event.alt_first_day + oneday
|
||||||
elif event.first_day and event.first_day < today:
|
elif event.first_day and event.first_day < today:
|
||||||
expired_at = event.first_day
|
expired_at = event.first_day + oneday
|
||||||
|
|
||||||
if expired_at:
|
if expired_at:
|
||||||
logger.info('Detected expired state of Event %s', event)
|
logger.info('Detected expired state of Event %s', event)
|
||||||
|
|||||||
Reference in New Issue
Block a user