From 1ede6441715bebd1517bad39a67ba609b18b171c Mon Sep 17 00:00:00 2001 From: daniele-andreotti Date: Fri, 15 Dec 2023 14:56:56 +0100 Subject: [PATCH] Improved "Buone pratiche" view for Event - US #49677 (#225) * Improved "Buone pratiche" view for Event: checking both for relation with Evenue and coordinates. * fixed typo * blacked --- CHANGES.rst | 3 ++- .../plone/contenttypes/browser/utils/check_eventi.py | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index feb8f7e7..4f70afe4 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,8 @@ Changelog 6.1.6 (unreleased) ------------------ -- Nothing changed yet. +- Improved "Buone pratiche" view for Event: checking both for relation with Venue and coordinates. + [daniele] 6.1.5 (2023-12-13) diff --git a/src/design/plone/contenttypes/browser/utils/check_eventi.py b/src/design/plone/contenttypes/browser/utils/check_eventi.py index 9f4e67f6..a5997fb6 100644 --- a/src/design/plone/contenttypes/browser/utils/check_eventi.py +++ b/src/design/plone/contenttypes/browser/utils/check_eventi.py @@ -25,10 +25,19 @@ def information_dict(self, evento): if not [x for x in res if x]: prezzo = "" + luoghi_correlati = False + if getattr(evento, "luoghi_correlati", None): + luoghi_correlati = True + elif getattr(evento, "geolocation", None): + if getattr(evento.geolocation, "latitude", "") and getattr( + evento.geolocation, "longitude", "" + ): + luoghi_correlati = True + return { "description": getattr(evento, "description", "").strip(), "effective_date": getattr(evento, "effective_date", None), - "luoghi_correlati": getattr(evento, "luoghi_correlati", None), + "luoghi_correlati": luoghi_correlati, "prezzo": prezzo, "contact_info": getattr(evento, "contact_info", None), }