Skip to content

Commit

Permalink
fix: failing test Nursing Task
Browse files Browse the repository at this point in the history
  • Loading branch information
akurungadam committed Oct 31, 2023
1 parent 59f8be4 commit 5063a5f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
[
{
"doctype":"Healthcare Activity",
"name":"BP Check",
"activity":"BP Check",
"description":"BP Check",
"activity_duration":60,
"role":"Nursing User",
"task_doctype":"Vital Signs"
},
{
"doctype": "Nursing Checklist Template",
"name": "Discharge checklist",
Expand All @@ -8,7 +17,7 @@
"doctype": "Nursing Checklist Template Task",
"activity": "BP Check",
"mandatory": 1,
"task_duration": 600,
"task_duration": 60,
"parent": "Discharge checklist",
"parentfield": "tasks",
"parenttype": "Nursing Checklist Template"
Expand Down
18 changes: 17 additions & 1 deletion healthcare/healthcare/doctype/nursing_task/test_nursing_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
class TestNursingTask(FrappeTestCase):
def setUp(self) -> None:
nursing_checklist_templates = frappe.get_test_records("Nursing Checklist Template")
self.nc_template = frappe.get_doc(nursing_checklist_templates[0]).insert(

self.activity = frappe.get_doc(nursing_checklist_templates[0]).insert(ignore_if_duplicate=True)
self.nc_template = frappe.get_doc(nursing_checklist_templates[1]).insert(
ignore_if_duplicate=True
)

Expand Down Expand Up @@ -131,4 +133,18 @@ def complete_nusing_tasks(document):
for task_name in tasks:
task = frappe.get_doc("Nursing Task", task_name)
task.status = "Completed"
task.task_document_name = create_vital_signs(document.patient)
task.save()


def create_vital_signs(patient):
return frappe.get_doc(
{
"doctype": "Vital Signs",
"patient": patient,
"signs_date": frappe.utils.nowdate(),
"signs_time": frappe.utils.nowtime(),
"bp_systolic": 120,
"bp_diastolic": 80,
}
).insert(ignore_if_duplicate=True)

0 comments on commit 5063a5f

Please sign in to comment.