diff --git a/ema/models/ema.py b/ema/models/ema.py index 2c61a241..f0c4d234 100644 --- a/ema/models/ema.py +++ b/ema/models/ema.py @@ -109,6 +109,16 @@ class Ema(AbstractCompensation, ShareableObjectMixin, RecordableObjectMixin): self.set_geometry_conflict_message(request) return request + def is_ready_for_publish(self) -> bool: + """ Checks whether the data passes all constraints for being publishable + + Returns: + is_ready (bool) : True|False + """ + is_recorded = self.recorded is not None + is_ready = is_recorded + return is_ready + class EmaDocument(AbstractDocument): """ diff --git a/ema/views.py b/ema/views.py index cc7bbc93..1e8b089c 100644 --- a/ema/views.py +++ b/ema/views.py @@ -464,7 +464,7 @@ def report_view(request:HttpRequest, id: str): tab_title = _("Report {}").format(ema.identifier) # If intervention is not recorded (yet or currently) we need to render another template without any data - if not ema.recorded: + if not ema.is_ready_for_publish(): template = "report/unavailable.html" context = { TAB_TITLE_IDENTIFIER: tab_title,