diff --git a/classification/models/classification_groups.py b/classification/models/classification_groups.py index fa1bca009..3486270e3 100644 --- a/classification/models/classification_groups.py +++ b/classification/models/classification_groups.py @@ -371,19 +371,25 @@ def __lt__(self, other): def conditions(self) -> List[ConditionResolved]: all_terms = set() all_plain_texts = set() + all_joins = set() for cm in self.modifications: c = cm.classification if resolved := c.condition_resolution_obj: for term in resolved.terms: all_terms.add(term) + all_joins.add(resolved.join) else: if text := cm.get(SpecialEKeys.CONDITION): all_plain_texts.add(text) all_condition_resolved = [] + shared_join = None + if len(all_joins) == 1: # if there's more than one join, we can't display it + shared_join = all_joins.pop() + for term in all_terms: - all_condition_resolved.append(ConditionResolved(terms=[term], join=None)) + all_condition_resolved.append(ConditionResolved(terms=[term], join=shared_join)) for plain_text in all_plain_texts: - all_condition_resolved.append(ConditionResolved(terms=[], join=None, plain_text=plain_text)) + all_condition_resolved.append(ConditionResolved(terms=[], join=shared_join, plain_text=plain_text)) all_condition_resolved.sort() return all_condition_resolved diff --git a/classification/templates/classification/classification_groups_mvl.html b/classification/templates/classification/classification_groups_mvl.html index 6232b1df4..c8ba7257e 100644 --- a/classification/templates/classification/classification_groups_mvl.html +++ b/classification/templates/classification/classification_groups_mvl.html @@ -1,5 +1,6 @@ {% load classification_tags %}
+{% spaceless %} @@ -22,11 +23,16 @@ {{ group.clinical_significance | ekey:'clinical_significance' }}
{{ group.clinical_significance_pending | ekey:'clinical_significance' }} (PENDING) {% else %}{{ group.clinical_significance | ekey:'clinical_significance' }}{% endif %} - + {% endfor %} -
{% for condition in group.conditions %}
{% condition condition_obj=condition limit=None %}
{% empty %}-{% endfor %}
{% for condition in group.conditions %}
{% condition condition_obj=condition limit=None no_links=True %}
{% empty %}-{% endfor %} + {% if group.conditions|length > 0 and group.conditions.0.join_text %} + {{ group.conditions.0.join_text }} + {% endif %} +
{{ group.zygosities | ekey:'zygosity' }} {% for acmg in group.acmg_criteria %}{% if not forloop.first %}, {% endif %}{{ acmg }}{% empty %}-{% endfor %}
{% with curated_date=group.most_recent_curated %}{% if curated_date.name %}{{ curated_date.name }} {% endif %}{{ curated_date.date | date:'Y-m-d' }}{% endwith %}
\ No newline at end of file + +{% endspaceless %} \ No newline at end of file diff --git a/classification/templates/classification/tags/classification_group_row.html b/classification/templates/classification/tags/classification_group_row.html index a23a438dc..145cc1abf 100644 --- a/classification/templates/classification/tags/classification_group_row.html +++ b/classification/templates/classification/tags/classification_group_row.html @@ -60,6 +60,9 @@ {% empty %}
-
{% endfor %} + {% if group.conditions|length > 0 and group.conditions.0.join_text %} + {{ group.conditions.0.join_text }} + {% endif %} {% if show_allele_origin %} diff --git a/classification/templates/classification/tags/condition.html b/classification/templates/classification/tags/condition.html index 4fbbb70fa..1927fc99c 100644 --- a/classification/templates/classification/tags/condition.html +++ b/classification/templates/classification/tags/condition.html @@ -2,7 +2,10 @@ {% if condition.terms %} {% for term in condition.terms %} {% if not forloop.first %}
{% endif %} - {{ term.id }} {{ term.name }} + {% if no_links %} + {{ term.id }} {{ term.name }} + {% else %} + {{ term.id }} {{ term.name }} + {% endif %} {% endfor %} - {% if condition.join_text %} {{ condition.join_text }}{% endif %} {% else %}{{ condition.plain_text | limit_length:limit }}{% endif %} \ No newline at end of file diff --git a/classification/templatetags/classification_tags.py b/classification/templatetags/classification_tags.py index 5b98ab5ba..d4a75fcbd 100644 --- a/classification/templatetags/classification_tags.py +++ b/classification/templatetags/classification_tags.py @@ -473,8 +473,8 @@ def db_ref(data: VCDbRefDict, css: Optional[str] = ''): @register.inclusion_tag("classification/tags/condition.html") -def condition(condition_obj: ConditionResolved, limit: Optional[int] = 100): - return {"condition": condition_obj, "limit": limit} +def condition(condition_obj: ConditionResolved, limit: Optional[int] = 100, no_links: Optional[bool] = None): + return {"condition": condition_obj, "limit": limit, "no_links": no_links} # look at removing this