From 3316e62ca749e9ab10301edf813c455e9bdef3b8 Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 17 Oct 2023 11:10:59 +0200 Subject: [PATCH] Refactor --- src/redturtle/prenotazioni/adapters/stringinterp.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/redturtle/prenotazioni/adapters/stringinterp.py b/src/redturtle/prenotazioni/adapters/stringinterp.py index 0eb22194..d6441e0b 100644 --- a/src/redturtle/prenotazioni/adapters/stringinterp.py +++ b/src/redturtle/prenotazioni/adapters/stringinterp.py @@ -255,16 +255,9 @@ def safe_call(self): site_url = api.portal.get().absolute_url() content_history_viewlet.navigation_root_url = site_url content_history_viewlet.site_url = site_url - history = content_history_viewlet.fullHistory() - refuse_history = sorted( - [ - i - for i in history - if i.get("type", "") == "workflow" and i.get("action", "") == "refuse" - ], - key=lambda i: i.get("time"), - reverse=True, - ) + history = content_history_viewlet.workflowHistory() + + refuse_history = [i for i in history if i.get("action", "") == "refuse"] refuse_message = refuse_history and refuse_history[0].get("comments") or ""