use of org.eyeseetea.malariacare.data.database.model.Question in project pictureapp by EyeSeeTea.
the class CompletionSurveyUseCase method rdtUsed.
private int rdtUsed(List<Value> surveyValues) {
int rdtUsed = 1;
Map<Question, Value> answersMap = Maps.uniqueIndex(surveyValues, valuesToQuestions);
Question rdtQuestion = Question.getRDTQuestion();
Question confirmInvalid = Question.getInvalidCounterQuestion();
if (answersMap.keySet().contains(confirmInvalid)) {
int invalids;
try {
invalids = Integer.parseInt(answersMap.get(confirmInvalid).getValue());
} catch (NumberFormatException exception) {
invalids = 1;
}
if (answersMap.get(rdtQuestion).getValue().equals("Invalid")) {
rdtUsed = invalids;
} else {
rdtUsed += invalids;
}
}
return rdtUsed;
}
use of org.eyeseetea.malariacare.data.database.model.Question in project pictureapp by EyeSeeTea.
the class ReviewFragmentStrategy method createViewRow.
public TableRow createViewRow(TableRow rowView, Value value) {
rowView.setTag(getCorrectQuestion(value.getQuestion()));
//Sets the value text in the row and add the question as tag.
CustomTextView questionTextView = (CustomTextView) rowView.findViewById(R.id.review_title_text);
if ((value.getQuestion() != null)) {
questionTextView.setText(value.getQuestion().getInternationalizedCodeDe_Name() + TITLE_SEPARATOR);
//Adds click listener to hide the fragment and go to the clicked question.
rowView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Question question = (Question) v.getTag();
DashboardActivity.dashboardActivity.hideReview(question);
}
});
questionTextView.setText(questionTextView.getText().toString() + ((value.getOption() != null) ? value.getOption().getInternationalizedCode() : value.getValue()));
if (value.getOption() != null && value.getOption().getBackground_colour() != null) {
rowView.setBackgroundColor(Color.parseColor("#" + value.getOption().getBackground_colour()));
}
}
return rowView;
}
use of org.eyeseetea.malariacare.data.database.model.Question in project pictureapp by EyeSeeTea.
the class ConfirmCounterSingleCustomViewStrategy method getCounterValue.
private String getCounterValue(Question question, Option selectedOption) {
Question optionCounter = question.findCounterByOption(selectedOption);
if (optionCounter == null) {
return "";
}
String counterValue = optionCounter.getQuestionValueBySession();
if (counterValue == null || counterValue.isEmpty()) {
return "1";
}
return String.valueOf((Integer.parseInt(counterValue) + 1));
}
Aggregations