Skip to content
Snippets Groups Projects
Commit e2c5f81b authored by Tanner Prestegard's avatar Tanner Prestegard Committed by GraceDB
Browse files

Updates to Notification display text

parent ab9beb65
No related branches found
No related tags found
No related merge requests found
...@@ -203,41 +203,50 @@ class Notification(models.Model): ...@@ -203,41 +203,50 @@ class Notification(models.Model):
if self.label_query: if self.label_query:
labels = '({0})'.format(self.label_query) labels = '({0})'.format(self.label_query)
else: else:
labels = " | ".join([l.name for l in self.labels.all()]) labels = " & ".join([l.name for l in self.labels.all()])
if self.labels.count() > 1: if self.labels.count() > 1:
labels = '({0})'.format(labels) labels = '({0})'.format(labels)
action = action.format(labels=labels) action = action.format(labels=labels)
else: else:
action = 'created or updated' if self.far_threshold or self.ns_candidate:
action = 'created or updated'
else:
action = 'created'
output += ' {action}'.format(action=action) output += ' {action}'.format(action=action)
# Add groups, pipelines, searches for event-type notifications # Add groups, pipelines, searches for event-type notifications
if self.category == self.NOTIFICATION_CATEGORY_EVENT: if self.category == self.NOTIFICATION_CATEGORY_EVENT:
output += ' & {groups} & {pipelines} & {searches}' output += ' & {groups} & {pipelines} & {searches}'
if self.groups.exists(): if self.groups.exists():
kwargs['groups'] = 'group=({0})'.format( grps = " | ".join([g.name for g in self.groups.all()])
" | ".join([g.name for g in self.groups.all()])) if self.groups.count() > 1:
grps = '({0})'.format(grps)
kwargs['groups'] = 'group={0}'.format(grps)
else: else:
kwargs['groups'] = 'any group' kwargs['groups'] = 'any group'
if self.pipelines.exists(): if self.pipelines.exists():
kwargs['pipelines'] = 'pipeline=({0})'.format( pipelines = " | ".join([p.name for p in self.pipelines.all()])
" | ".join([p.name for p in self.pipelines.all()])) if self.pipelines.count() > 1:
pipelines = '({0})'.format(pipelines)
kwargs['pipelines'] = 'pipeline={0}'.format(pipelines)
else: else:
kwargs['pipelines'] = 'any pipeline' kwargs['pipelines'] = 'any pipeline'
if self.searches.exists(): if self.searches.exists():
kwargs['searches'] = 'search=({0})'.format( searches = " | ".join([s.name for s in self.searches.all()])
" | ".join([s.name for s in self.searches.all()])) if self.searches.count() > 1:
searches = '({0})'.format(searches)
kwargs['searches'] = 'search={0}'.format(searches)
else: else:
kwargs['searches'] = 'any search' kwargs['searches'] = 'any search'
# Optionally add FAR threshold # Optionally add FAR threshold
if self.far_threshold: if self.far_threshold:
output += ' & (FAR < {far_threshold})' output += ' & FAR < {far_threshold}'
kwargs['far_threshold'] = self.far_threshold kwargs['far_threshold'] = self.far_threshold
# Optionally add NS candidate info # Optionally add NS candidate info
if self.ns_candidate: if self.ns_candidate:
output += ' & NS candidate' output += ' & Is NS candidate'
# Add contacts # Add contacts
output += ' -> {contacts}' output += ' -> {contacts}'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment