Skip to content
Snippets Groups Projects
Commit 53acfb9b authored by Benjamin Hättasch's avatar Benjamin Hättasch Committed by Nadja Geisler
Browse files

Hide headings for empty constraints in detail representation of AKSlot

This will remove empty lines from the "bubbles" containing details in scheduler.
This implements #215
parent 2506327c
Branches
No related tags found
1 merge request!215Improve scheduling
...@@ -367,7 +367,7 @@ class AK(models.Model): ...@@ -367,7 +367,7 @@ class AK(models.Model):
@property @property
def details(self): def details(self):
""" """
Generate a detailled string representation, e.g., for usage in scheduling Generate a detailed string representation, e.g., for usage in scheduling
:return: string representation of that AK with all details :return: string representation of that AK with all details
:rtype: str :rtype: str
""" """
...@@ -376,15 +376,19 @@ class AK(models.Model): ...@@ -376,15 +376,19 @@ class AK(models.Model):
from AKModel.availability.models import Availability from AKModel.availability.models import Availability
availabilities = ', \n'.join(f'{a.simplified}' for a in Availability.objects.select_related('event') availabilities = ', \n'.join(f'{a.simplified}' for a in Availability.objects.select_related('event')
.filter(ak=self)) .filter(ak=self))
return f"""{self.name}{" (R)" if self.reso else ""}: detail_string = f"""{self.name}{" (R)" if self.reso else ""}:
{self.owners_list} {self.owners_list}
{_('Interest')}: {self.interest} {_('Interest')}: {self.interest}"""
{_("Requirements")}: {", ".join(str(r) for r in self.requirements.all())} if self.requirements.count() > 0:
{_("Conflicts")}: {", ".join(str(c) for c in self.conflicts.all())} detail_string += f"\n{_('Requirements')}: {', '.join(str(r) for r in self.requirements.all())}"
{_("Prerequisites")}: {", ".join(str(p) for p in self.prerequisites.all())} if self.conflicts.count() > 0:
{_("Availabilities")}: \n{availabilities}""" detail_string += f"\n{_('Conflicts')}: {', '.join(str(c) for c in self.conflicts.all())}"
if self.prerequisites.count() > 0:
detail_string += f"\n{_('Prerequisites')}: {', '.join(str(p) for p in self.prerequisites.all())}"
detail_string += f"\n{_('Availabilities')}: \n{availabilities}"
return detail_string
@property @property
def owners_list(self): def owners_list(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment