Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bumped up core library version #1711

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

public class ChwApplicationFlv extends DefaultChwApplicationFlv {

@Override
public boolean saveOnSubmission() {
return true;
}

@Override
public boolean hasFamilyKitCheck() {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@

import timber.log.Timber;

import static org.smartregister.chw.util.Utils.getLastIPTPServiceIteration;

public abstract class DefaultAncHomeVisitInteractorFlv implements AncHomeVisitInteractor.Flavor {

protected MemberObject memberObject;
Expand Down Expand Up @@ -90,9 +92,9 @@ public LinkedHashMap<String, BaseAncHomeVisitAction> calculateActions(BaseAncHom
evaluateSleepingUnderLLITN();
evaluateANCCard();
evaluateHealthFacilityVisit(dateMap);
evaluateObservation();
evaluateTTImmunization(vaccineTaskModel);
evaluateIPTP();
evaluateObservation();
} catch (BaseAncHomeVisitAction.ValidationException e) {
throw (e);
} catch (Exception e) {
Expand Down Expand Up @@ -175,8 +177,9 @@ protected void evaluateTTImmunization(VaccineTaskModel vaccineTaskModel) throws
return;
}
// compute the due date

final Triple<DateTime, VaccineRepo.Vaccine, String> individualVaccine = VaccineScheduleUtil.getIndividualVaccine(vaccineTaskModel, "TT");
if (individualVaccine == null || individualVaccine.getLeft().isAfter(new DateTime())) {
if (individualVaccine == null) {
return;
}

Expand Down Expand Up @@ -210,7 +213,7 @@ protected void evaluateTTImmunization(VaccineTaskModel vaccineTaskModel) throws
.build();

// don't show if its after now
if (!individualVaccine.getLeft().isAfterNow()) {
if (editMode || !individualVaccine.getLeft().isAfterNow()) {
actionList.put(title, tt_immunization);
}
}
Expand Down Expand Up @@ -247,8 +250,9 @@ protected void evaluateIPTP() throws Exception {
if (serviceWrapper == null && !editMode) return;
if (!editMode)
serviceIteration = serviceWrapper.getName().substring(serviceWrapper.getName().length() - 1);
else
serviceIteration = visitDetail.get(0).getPreProcessedJson().substring(visitDetail.get(0).getPreProcessedJson().length() - 1);
else {
serviceIteration = getLastIPTPServiceIteration(visitDetail.get(0).getVisitKey());
}

String iptp = MessageFormat.format(context.getString(R.string.anc_home_visit_iptp_sp), serviceIteration);
String dueState = (overdueMonth < 1) ? context.getString(R.string.due) : context.getString(R.string.overdue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,7 @@ public static String getClientName(String firstName, String middleName, String l
}
}

public static String getLastIPTPServiceIteration(String visitKey) {
return String.valueOf(visitKey.charAt(4));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,11 @@ public void testGetWFHZScore() {
double score = org.smartregister.chw.util.Utils.getWFHZScore("Male", "70", "70");
Assert.assertNotEquals(100.0, score, 0.0);
}

@Test
public void testGetLastIPTPServiceIteration() {
String iteration1 = "1";
String visitKeyOne = "iptp1_dose";
Assert.assertEquals(iteration1, org.smartregister.chw.util.Utils.getLastIPTPServiceIteration(visitKeyOne));
}
}