Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/clinicedc/edc-action-item
Browse files Browse the repository at this point in the history
…into develop
  • Loading branch information
JonathanWillitts committed Feb 2, 2024
2 parents 160db56 + a234faf commit d897213
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
1 change: 0 additions & 1 deletion edc_action_item/models/action_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ def save(self, *args, **kwargs):
self.priority = self.priority or self.action_type.priority
self.reference_model = self.action_type.reference_model
self.related_reference_model = self.action_type.related_reference_model
self.instructions = self.action_type.instructions
else:
if (
self.status in [NEW, CANCELLED]
Expand Down
33 changes: 32 additions & 1 deletion edc_action_item/system_checks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.core.checks import Warning
from django.core.checks import Error, Warning

from .models import ActionItem
from .site_action_items import site_action_items


Expand All @@ -19,7 +20,37 @@ def edc_action_item_check(app_configs, **kwargs):
),
hint="History manager is need to detect changes.",
obj=action_cls,
id="edc_action_item.W001",
)
)
for action_item in ActionItem.objects.all():
if action_item.reference_model != action_item.action_type.reference_model:
errors.append(
Error(
(
"Action item reference model value does not match "
"action_type.reference_model. "
f"Got {action_item.reference_model} != "
f"{action_item.action_type.reference_model}"
),
obj=action_item,
id="edc_action_item.E001",
)
)
if (
action_item.related_reference_model
!= action_item.action_type.related_reference_model
):
errors.append(
Error(
(
"Action item related_reference_modell value does not match "
"action_type.related_reference_model. "
f"Got {action_item.related_reference_model} != "
f"{action_item.action_type.related_reference_model}"
),
obj=action_item,
id="edc_action_item.E002",
)
)
return errors
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<span class='label label-{% if action_item.priority == HIGH_PRIORITY %}danger{% else %}warning{% endif %}'>{{ action_item.get_priority_display|title }}</span>
<h6>{{ action_item.display_name|default:'alert' }}</h6>
<p class='text text-muted'>{% render_action_item_reason action_item %}</p>
{% if action_item.instructions %}<p class='text text-muted'><small>{{ action_item.instructions|truncatechars:250 }}</small></p>{% endif %}
{% if action_item.action_type.instructions %}<p class='text text-muted'><small>{{ action_item.action_type.instructions|truncatechars:250 }}</small></p>{% endif %}
<p class='text text-muted'>
<small>{% trans "Opened on" %} {{ report_datetime }}. {% if date_last_updated %}{% trans "Last updated on" %} {{date_last_updated}} {% if user_last_updated %}{% trans "by" %} {{user_last_updated}}{% endif %}{% else %}{% trans "This action item has not been updated." %}{% endif %}</small>
</p>
Expand Down

0 comments on commit d897213

Please sign in to comment.