use of org.eyeseetea.malariacare.domain.entity.Survey in project pictureapp by EyeSeeTea.
the class SurveyLocalDataSource method getLastSentSurveys.
@Override
public List<Survey> getLastSentSurveys(int count) {
List<Survey> surveys = new ArrayList<>();
List<org.eyeseetea.malariacare.data.database.model.Survey> surveysInDB = org.eyeseetea.malariacare.data.database.model.Survey.getAllHideAndSentSurveys(count);
for (org.eyeseetea.malariacare.data.database.model.Survey surveyDB : surveysInDB) {
Survey survey = new Survey(surveyDB.getEventDate());
surveys.add(survey);
}
return surveys;
}
use of org.eyeseetea.malariacare.domain.entity.Survey in project pictureapp by EyeSeeTea.
the class OverLimitSurveysDomainServiceTest method should_return_false_if_surveys_count_is_under_threshold_and_difference_time_is_over_threshold.
@Test
public void should_return_false_if_surveys_count_is_under_threshold_and_difference_time_is_over_threshold() {
List<Survey> surveys = givenThereAre30SurveysIn2Hours();
SurveysThresholds surveyThreshold = new SurveysThresholdBuilder().withCount(40).withTimeHour(1).build();
boolean isOverLimit = OverLimitSurveysDomainService.isSurveysOverLimit(surveys, surveyThreshold);
assertThat(isOverLimit, is(false));
}
use of org.eyeseetea.malariacare.domain.entity.Survey in project pictureapp by EyeSeeTea.
the class OverLimitSurveysDomainServiceTest method should_return_false_if_time_hours_threshold_is_equal_to_0.
@Test
public void should_return_false_if_time_hours_threshold_is_equal_to_0() {
List<Survey> surveys = givenThereAre30SurveysIn2Hours();
SurveysThresholds surveyThreshold = new SurveysThresholdBuilder().withCount(20).withTimeHour(0).build();
boolean isOverLimit = OverLimitSurveysDomainService.isSurveysOverLimit(surveys, surveyThreshold);
assertThat(isOverLimit, is(false));
}
use of org.eyeseetea.malariacare.domain.entity.Survey in project pictureapp by EyeSeeTea.
the class OverLimitSurveysDomainServiceTest method should_return_false_if_count_threshold_is_equal_to_0.
@Test
public void should_return_false_if_count_threshold_is_equal_to_0() {
List<Survey> surveys = givenThereAre30SurveysIn2Hours();
SurveysThresholds surveyThreshold = new SurveysThresholdBuilder().withCount(0).withTimeHour(1).build();
boolean isOverLimit = OverLimitSurveysDomainService.isSurveysOverLimit(surveys, surveyThreshold);
assertThat(isOverLimit, is(false));
}
use of org.eyeseetea.malariacare.domain.entity.Survey in project pictureapp by EyeSeeTea.
the class OverLimitSurveysDomainServiceTest method should_return_true_if_surveys_count_is_equal_to_threshold_and_difference_time_is_equal_to_threshold.
@Test
public void should_return_true_if_surveys_count_is_equal_to_threshold_and_difference_time_is_equal_to_threshold() {
List<Survey> surveys = givenThereAre30SurveysIn2Hours();
SurveysThresholds surveyThreshold = new SurveysThresholdBuilder().withCount(30).withTimeHour(2).build();
boolean isOverLimit = OverLimitSurveysDomainService.isSurveysOverLimit(surveys, surveyThreshold);
assertThat(isOverLimit, is(true));
}
Aggregations