def test_check_goal_status(self): testAssign, testPatient, testProcedure = self.test_create_assignedProcedure( ) result = AssignedProcedures.check_goal_status(testPatient, testProcedure) self.assertEqual(result, "not scheduled") tAssignment = AssignedProcedures.assign_procedure_to_patient( step=2, patientToLink=testPatient, procedureToLink=testProcedure, proc_est=2, return_visit=True) resultz = AssignedProcedures.check_goal_status(testPatient, testProcedure, 2) self.assertEqual(resultz, "in progress (on time)") AssignedProcedures.toggle_completed(testPatient, testProcedure, 2) tAssignment = AssignedProcedures.assign_procedure_to_patient( step=3, patientToLink=testPatient, procedureToLink=testProcedure, proc_est=2, return_visit=True) resultz = AssignedProcedures.check_goal_status(testPatient, testProcedure, 2) self.assertEqual(resultz, "completed (on time)")
def return_all_behind_procedures(): allLateProcedures = [] for incompleteProcedure in AssignedProcedures.get_all_active_procedures( ): incompleteProcedurePatient = incompleteProcedure.patient.all()[0] incompleteProcedureProc = incompleteProcedure.procedure.all()[0] assignedProcStatus = AssignedProcedures.check_goal_status( incompleteProcedurePatient, incompleteProcedureProc) if assignedProcStatus == "in progress (behind)": allLateProcedures.append(incompleteProcedure) return allLateProcedures
def flag_update(self): import assigned_procedures from assigned_procedures.models import AssignedProcedures assignedProcs = AssignedProcedures.get_all_procedures(self) for procedureToCheck in assignedProcs: result = AssignedProcedures.check_goal_status( self, procedureToCheck[0], 1) if result == "in progress (behind)": self.behind_flag = True self.save() return procedureToCheck[0], True self.behind_flag = False self.save() return None, False