From e585f6057b6fa7bb47a7f6d35a1182fab45f85df Mon Sep 17 00:00:00 2001 From: heinzel Date: Thu, 7 Jan 2021 13:28:41 +0100 Subject: [PATCH] UPD: display status flag canceled or realized also if cleared is set --- dav_events/workflow.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/dav_events/workflow.py b/dav_events/workflow.py index ff4bc10..c173c41 100644 --- a/dav_events/workflow.py +++ b/dav_events/workflow.py @@ -266,16 +266,21 @@ class BasicWorkflow(object): heaviest_flag = event.flags.order_by('status').last() if heaviest_flag: - flags = [] last_status = heaviest_flag.status if last_status.code.startswith('publishing_'): - flags += event.flags.filter(status__code='accepted') + flags = event.flags.filter(status__code='accepted') + flags.append(heaviest_flag) elif last_status.code.startswith('published_'): if event.flags.filter(status__code='publishing').exists(): - flags += event.flags.filter(status__code='publishing') + flags = event.flags.filter(status__code='publishing') else: - flags += event.flags.filter(status__code='accepted') - flags.append(heaviest_flag) + flags = event.flags.filter(status__code='accepted') + flags.append(heaviest_flag) + elif last_status.code.startswith('clear'): + flags = [heaviest_flag] + flags += event.flags.filter(status__code__in=('canceled', 'realized')) + else: + flags = [heaviest_flag] deferred_publishing = event.planned_publication_date and event.planned_publication_date > today add_publishing_date = False