From 15073041461d2656e9612ea2c461b221c4aefd4e Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Thu, 22 Oct 2020 16:51:08 +0100 Subject: now processes a an empty event list --- ctrack/register/css.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'ctrack/register/css.py') diff --git a/ctrack/register/css.py b/ctrack/register/css.py index 9b1f150..65a2c43 100644 --- a/ctrack/register/css.py +++ b/ctrack/register/css.py @@ -47,10 +47,19 @@ class Swimlane: ) def table_row_builder(self): + org = self.org_name if len(self.events) == 0: - raise ValueError("Cannot handle an empty list") + tmpl = "{1}" + processing_these_attrs = [x.type_descriptor for x in self.__dict__.values() if isinstance(x, EventBase)] + empties = [{e: tmpl.format("", e)} for e in self.attrs_added if + e[:3] == "CAF" and e not in processing_these_attrs] + empties = sorted(empties, key=self._sort_func) + empties = [list(x.values())[0] for x in empties] + empties = "\n".join(empties) + return "".join( + ["\n", f"{org}\n", empties, "\n", ""] + ) tmpl = "{1}" - org = self.events[0].related_caf.organisation.name processing_these_attrs = [x.type_descriptor for x in self.__dict__.values() if isinstance(x, EventBase)] empties = [{e: tmpl.format("", e)} for e in self.attrs_added if e[:3] == "CAF" and e not in processing_these_attrs] -- cgit v1.2.3