Skip to content

Commit

Permalink
Merge 3759005 into 89c85af
Browse files Browse the repository at this point in the history
  • Loading branch information
rehammuzzamil authored Jul 9, 2020
2 parents 89c85af + 3759005 commit 5a2559c
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ public enum ResourceType {
FAMILY("Family"),
PERSON("Person"),
TASK("Task"),
QUESTIONAIRRE_RESPONSE("QuestionnaireResponse");

QUESTIONAIRRE_RESPONSE("QuestionnaireResponse"),
GLOBAL_TASK("Global.Task");

private String value;

private ResourceType(String value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ public List<? extends Resource> getConditionSubjectResources(Resource resource,

case QUESTIONAIRRE_RESPONSE:
return PathEvaluatorLibrary.getInstance().getEventProvider().getEvents(resource, planIdentifier);

case GLOBAL_TASK:
return PathEvaluatorLibrary.getInstance().getTaskProvider().getAllTasks(resource.getId());

default:
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@ public interface TaskDao {
void saveTask(org.smartregister.domain.Task task, QuestionnaireResponse questionnaireResponse);

boolean checkIfTaskExists(String baseEntityId, String planIdentifier, String code);

List<Task> findAllTasksForEntity(String id);

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,11 @@ public List<Task> getTasks(Resource resource, String planIdentifier) {
return taskDao.findTasksForEntity(resource.getId(), planIdentifier);

}

public List<Task> getAllTasks(String id) {

return taskDao.findAllTasksForEntity(id);

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -219,5 +219,14 @@ public void testGetQuestionnaireConditionResourcesV2() {
assertEquals(expected, actionHelper.getConditionSubjectResources(condition, action, questionnaireResponse, plan));
verify(eventProvider).getEvents(questionnaireResponse, plan);
}

@Test
public void testGetGlobalTaskConditionResources() {
subjectConcept.setText(ResourceType.GLOBAL_TASK.value());
List<Task> expected = Collections.singletonList(TestData.createTask());
when(taskProvider.getAllTasks(patient.getId())).thenReturn(expected);
assertEquals(expected, actionHelper.getConditionSubjectResources(condition, action, patient, plan));
verify(taskProvider).getAllTasks(patient.getId());
}

}

0 comments on commit 5a2559c

Please sign in to comment.