diff --git a/gradle.properties b/gradle.properties index 056dd41b..86651532 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=3.0.1-SNAPSHOT +VERSION_NAME=3.0.2-SNAPSHOT VERSION_CODE=2 GROUP=org.smartregister POM_SETTING_DESCRIPTION=OpenSRP Client Immunization diff --git a/opensrp-immunization/src/main/java/org/smartregister/immunization/domain/ServiceRecord.java b/opensrp-immunization/src/main/java/org/smartregister/immunization/domain/ServiceRecord.java index 428d0cd0..d7ad451e 100644 --- a/opensrp-immunization/src/main/java/org/smartregister/immunization/domain/ServiceRecord.java +++ b/opensrp-immunization/src/main/java/org/smartregister/immunization/domain/ServiceRecord.java @@ -26,6 +26,7 @@ public class ServiceRecord { private String team; private String teamId; private String childLocationId; + private Integer isVoided; public ServiceRecord() { } @@ -213,4 +214,12 @@ public String getChildLocationId() { public void setChildLocationId(String childLocationId) { this.childLocationId = childLocationId; } + + public Integer getIsVoided() { + return isVoided; + } + + public void setIsVoided(Integer isVoided) { + this.isVoided = isVoided; + } } diff --git a/opensrp-immunization/src/main/java/org/smartregister/immunization/domain/Vaccine.java b/opensrp-immunization/src/main/java/org/smartregister/immunization/domain/Vaccine.java index fe3650c9..39d0ba9d 100644 --- a/opensrp-immunization/src/main/java/org/smartregister/immunization/domain/Vaccine.java +++ b/opensrp-immunization/src/main/java/org/smartregister/immunization/domain/Vaccine.java @@ -24,6 +24,7 @@ public class Vaccine { private Long updatedAt; private String eventId; private String formSubmissionId; + private Integer isVoided; private Integer outOfCatchment; private Date createdAt; @@ -53,7 +54,7 @@ public Vaccine(Long id, String baseEntityId, String name, Integer calculation, D public Vaccine(Long id, String baseEntityId, String programClientId, String name, Integer calculation, Date date, String anmId, String locationId, String syncStatus, String hia2Status, Long updatedAt, String eventId, String formSubmissionId, Integer - outOfCatchment, Date createdAt) { + outOfCatchment, Date createdAt, Integer isVoided) { this.id = id; this.baseEntityId = baseEntityId; this.programClientId = programClientId; @@ -69,6 +70,7 @@ public Vaccine(Long id, String baseEntityId, String programClientId, String name this.formSubmissionId = formSubmissionId; this.outOfCatchment = outOfCatchment; this.createdAt = createdAt; + this.isVoided = isVoided; } public Long getId() { @@ -104,6 +106,14 @@ public HashMap getIdentifiers() { return identifiers; } + public Integer getIsVoided() { + return isVoided; + } + + public void setIsVoided(Integer isVoided) { + this.isVoided = isVoided; + } + public String getName() { return name; } diff --git a/opensrp-immunization/src/main/java/org/smartregister/immunization/repository/RecurringServiceRecordRepository.java b/opensrp-immunization/src/main/java/org/smartregister/immunization/repository/RecurringServiceRecordRepository.java index e7691828..a2f57bd8 100644 --- a/opensrp-immunization/src/main/java/org/smartregister/immunization/repository/RecurringServiceRecordRepository.java +++ b/opensrp-immunization/src/main/java/org/smartregister/immunization/repository/RecurringServiceRecordRepository.java @@ -50,6 +50,7 @@ public class RecurringServiceRecordRepository extends BaseRepository { private static final String BASE_ENTITY_ID_INDEX = "CREATE INDEX " + TABLE_NAME + "_" + BASE_ENTITY_ID + "_index ON " + TABLE_NAME + "(" + BASE_ENTITY_ID + " COLLATE NOCASE);"; private static final String UPDATED_AT_INDEX = "CREATE INDEX " + TABLE_NAME + "_" + UPDATED_AT_COLUMN + "_index ON " + TABLE_NAME + "(" + UPDATED_AT_COLUMN + ");"; public static final String UPDATE_TABLE_ADD_OUT_OF_AREA_COL = "ALTER TABLE " + TABLE_NAME + " ADD COLUMN " + VaccineRepository.OUT_OF_AREA + " INTEGER;"; + public static final String UPDATE_TABLE_ADD_IS_VOIDED_COL = "ALTER TABLE " + TABLE_NAME + " ADD COLUMN " + VaccineRepository.IS_VOIDED + " INTEGER;"; public static void createTable(SQLiteDatabase database) { database.execSQL(CREATE_TABLE_SQL); @@ -59,6 +60,7 @@ public static void createTable(SQLiteDatabase database) { database.execSQL(FORMSUBMISSION_INDEX); database.execSQL(UPDATED_AT_INDEX); database.execSQL(UPDATE_TABLE_ADD_OUT_OF_AREA_COL); + database.execSQL(UPDATE_TABLE_ADD_IS_VOIDED_COL); } public static void migrateCreatedAt(SQLiteDatabase database) { diff --git a/opensrp-immunization/src/main/java/org/smartregister/immunization/repository/VaccineRepository.java b/opensrp-immunization/src/main/java/org/smartregister/immunization/repository/VaccineRepository.java index adb3e113..c5ffc86e 100644 --- a/opensrp-immunization/src/main/java/org/smartregister/immunization/repository/VaccineRepository.java +++ b/opensrp-immunization/src/main/java/org/smartregister/immunization/repository/VaccineRepository.java @@ -41,16 +41,19 @@ public class VaccineRepository extends BaseRepository { public static final String HIA2_STATUS = "hia2_status"; public static final String UPDATED_AT_COLUMN = "updated_at"; public static final String OUT_OF_AREA = "out_of_area"; + public static final String IS_VOIDED = "is_voided"; public static final String CREATED_AT = "created_at"; public static final String TEAM_ID = "team_id"; public static final String TEAM = "team"; - public static final String[] VACCINE_TABLE_COLUMNS = {ID_COLUMN, BASE_ENTITY_ID, PROGRAM_CLIENT_ID, NAME, CALCULATION, DATE, ANMID, LOCATION_ID, CHILD_LOCATION_ID, TEAM, TEAM_ID, SYNC_STATUS, HIA2_STATUS, UPDATED_AT_COLUMN, EVENT_ID, FORMSUBMISSION_ID, OUT_OF_AREA, CREATED_AT}; + public static final String[] VACCINE_TABLE_COLUMNS = {ID_COLUMN, BASE_ENTITY_ID, PROGRAM_CLIENT_ID, NAME, CALCULATION, DATE, ANMID, LOCATION_ID, CHILD_LOCATION_ID, TEAM, TEAM_ID, SYNC_STATUS, HIA2_STATUS, UPDATED_AT_COLUMN, EVENT_ID, FORMSUBMISSION_ID, OUT_OF_AREA, IS_VOIDED, CREATED_AT}; public static final String UPDATE_TABLE_ADD_EVENT_ID_COL = "ALTER TABLE " + VACCINE_TABLE_NAME + " ADD COLUMN " + EVENT_ID + " VARCHAR;"; public static final String EVENT_ID_INDEX = "CREATE INDEX " + VACCINE_TABLE_NAME + "_" + EVENT_ID + "_index ON " + VACCINE_TABLE_NAME + "(" + EVENT_ID + " COLLATE NOCASE);"; public static final String UPDATE_TABLE_ADD_FORMSUBMISSION_ID_COL = "ALTER TABLE " + VACCINE_TABLE_NAME + " ADD COLUMN " + FORMSUBMISSION_ID + " VARCHAR;"; public static final String FORMSUBMISSION_INDEX = "CREATE INDEX " + VACCINE_TABLE_NAME + "_" + FORMSUBMISSION_ID + "_index ON " + VACCINE_TABLE_NAME + "(" + FORMSUBMISSION_ID + " COLLATE NOCASE);"; public static final String UPDATE_TABLE_ADD_OUT_OF_AREA_COL = "ALTER TABLE " + VACCINE_TABLE_NAME + " ADD COLUMN " + OUT_OF_AREA + " INTEGER;"; + public static final String UPDATE_TABLE_ADD_IS_VOIDED_COL = "ALTER TABLE " + VACCINE_TABLE_NAME + " ADD COLUMN " + IS_VOIDED + " INTEGER;"; public static final String UPDATE_TABLE_ADD_OUT_OF_AREA_COL_INDEX = "CREATE INDEX " + VACCINE_TABLE_NAME + "_" + OUT_OF_AREA + "_index ON " + VACCINE_TABLE_NAME + "(" + OUT_OF_AREA + " COLLATE NOCASE);"; + public static final String UPDATE_TABLE_ADD_IS_VOIDED_COL_INDEX = "CREATE INDEX " + VACCINE_TABLE_NAME + "_" + IS_VOIDED + "_index ON " + VACCINE_TABLE_NAME + "(" + IS_VOIDED + " COLLATE NOCASE);"; public static final String UPDATE_TABLE_ADD_HIA2_STATUS_COL = "ALTER TABLE " + VACCINE_TABLE_NAME + " ADD COLUMN " + HIA2_STATUS + " VARCHAR;"; public static final String ALTER_ADD_CREATED_AT_COLUMN = "ALTER TABLE " + VACCINE_TABLE_NAME + " ADD COLUMN " + CREATED_AT + " DATETIME NULL "; public static final String UPDATE_TABLE_ADD_TEAM_COL = "ALTER TABLE " + VACCINE_TABLE_NAME + " ADD COLUMN " + TEAM + " VARCHAR;"; @@ -157,7 +160,7 @@ public void update(SQLiteDatabase database, Vaccine vaccine) { try { String idSelection = ID_COLUMN + " = ?"; database.update(VACCINE_TABLE_NAME, createValuesFor(vaccine), idSelection, - new String[] {vaccine.getId().toString()}); + new String[]{vaccine.getId().toString()}); } catch (Exception e) { Log.e(TAG, Log.getStackTraceString(e)); } @@ -182,6 +185,7 @@ private ContentValues createValuesFor(Vaccine vaccine) { values.put(EVENT_ID, vaccine.getEventId()); values.put(FORMSUBMISSION_ID, vaccine.getFormSubmissionId()); values.put(OUT_OF_AREA, vaccine.getOutOfCatchment()); + values.put(IS_VOIDED, vaccine.getIsVoided()); values.put(CREATED_AT, vaccine.getCreatedAt() != null ? EventClientRepository.dateFormat.format(vaccine.getCreatedAt()) : null); return values; @@ -204,7 +208,7 @@ public List findUnSyncedBeforeTime(int minutes) { Long time = calendar.getTimeInMillis(); cursor = getReadableDatabase().query(VACCINE_TABLE_NAME, VACCINE_TABLE_COLUMNS, - UPDATED_AT_COLUMN + " < ? AND " + SYNC_STATUS + " = ? ", new String[] {time.toString(), TYPE_Unsynced}, + UPDATED_AT_COLUMN + " < ? AND " + SYNC_STATUS + " = ? ", new String[]{time.toString(), TYPE_Unsynced}, null, null, null, null); vaccines = readAllVaccines(cursor); } catch (Exception e) { @@ -223,7 +227,7 @@ public List findUnSynced() { try { cursor = getReadableDatabase().query(VACCINE_TABLE_NAME, VACCINE_TABLE_COLUMNS, - SYNC_STATUS + " = ? ", new String[] {TYPE_Unsynced}, + SYNC_STATUS + " = ? ", new String[]{TYPE_Unsynced}, null, null, null, null); vaccines = readAllVaccines(cursor); } catch (Exception e) { @@ -271,7 +275,8 @@ public List readAllVaccines(Cursor cursor) { cursor.getString(cursor.getColumnIndex(EVENT_ID)), cursor.getString(cursor.getColumnIndex(FORMSUBMISSION_ID)), cursor.getInt(cursor.getColumnIndex(OUT_OF_AREA)), - createdAt + createdAt, + cursor.getInt(cursor.getColumnIndex(IS_VOIDED)) ); vaccine.setTeam(cursor.getString(cursor.getColumnIndex(TEAM))); @@ -301,7 +306,7 @@ public static String removeHyphen(String s) { public List findByEntityId(String entityId) { SQLiteDatabase database = getReadableDatabase(); Cursor cursor = database.query(VACCINE_TABLE_NAME, VACCINE_TABLE_COLUMNS, - BASE_ENTITY_ID + " = ? " + COLLATE_NOCASE + " ORDER BY " + UPDATED_AT_COLUMN, new String[] {entityId}, null, + BASE_ENTITY_ID + " = ? " + COLLATE_NOCASE + " ORDER BY " + UPDATED_AT_COLUMN, new String[]{entityId}, null, null, null, null); return readAllVaccines(cursor); } @@ -310,7 +315,7 @@ public List findLatestTwentyFourHoursByEntityId(String entityId) { SQLiteDatabase database = getReadableDatabase(); Cursor cursor = database.query(VACCINE_TABLE_NAME, VACCINE_TABLE_COLUMNS, BASE_ENTITY_ID + " = ? and (" + UPDATED_AT_COLUMN + "/1000 < strftime('%s',datetime('now','-1 day')))", - new String[] {entityId}, null, null, null, null); + new String[]{entityId}, null, null, null, null); return readAllVaccines(cursor); } @@ -329,13 +334,13 @@ public Vaccine findUnique(SQLiteDatabase database, Vaccine vaccine) { String[] selectionArgs = null; if (StringUtils.isNotBlank(vaccine.getFormSubmissionId()) && StringUtils.isNotBlank(vaccine.getEventId())) { selection = FORMSUBMISSION_ID + " = ? " + COLLATE_NOCASE + " OR " + EVENT_ID + " = ? " + COLLATE_NOCASE; - selectionArgs = new String[] {vaccine.getFormSubmissionId(), vaccine.getEventId()}; + selectionArgs = new String[]{vaccine.getFormSubmissionId(), vaccine.getEventId()}; } else if (StringUtils.isNotBlank(vaccine.getEventId())) { selection = EVENT_ID + " = ? " + COLLATE_NOCASE; - selectionArgs = new String[] {vaccine.getEventId()}; + selectionArgs = new String[]{vaccine.getEventId()}; } else if (StringUtils.isNotBlank(vaccine.getFormSubmissionId())) { selection = FORMSUBMISSION_ID + " = ? " + COLLATE_NOCASE; - selectionArgs = new String[] {vaccine.getFormSubmissionId()}; + selectionArgs = new String[]{vaccine.getFormSubmissionId()}; } Cursor cursor = database.query(VACCINE_TABLE_NAME, VACCINE_TABLE_COLUMNS, selection, selectionArgs, null, null, @@ -372,7 +377,7 @@ public List findWithNullHia2Status() { public void deleteVaccine(String baseEntityId, String vaccineName) { try { - getWritableDatabase().delete(VACCINE_TABLE_NAME, BASE_ENTITY_ID + " = ? AND " + NAME + " = ? ", new String[] {baseEntityId, vaccineName}); + getWritableDatabase().delete(VACCINE_TABLE_NAME, BASE_ENTITY_ID + " = ? AND " + NAME + " = ? ", new String[]{baseEntityId, vaccineName}); updateFtsSearch(baseEntityId, vaccineName); } catch (Exception e) { Timber.e(e); @@ -383,7 +388,7 @@ public void deleteVaccine(Long caseId) { try { Vaccine vaccine = find(caseId); if (vaccine != null) { - getWritableDatabase().delete(VACCINE_TABLE_NAME, ID_COLUMN + "= ?", new String[] {caseId.toString()}); + getWritableDatabase().delete(VACCINE_TABLE_NAME, ID_COLUMN + "= ?", new String[]{caseId.toString()}); updateFtsSearch(vaccine.getBaseEntityId(), vaccine.getName()); } @@ -397,7 +402,7 @@ public Vaccine find(Long caseId) { Cursor cursor = null; try { cursor = getReadableDatabase() - .query(VACCINE_TABLE_NAME, VACCINE_TABLE_COLUMNS, ID_COLUMN + " = ?", new String[] {caseId.toString()}, + .query(VACCINE_TABLE_NAME, VACCINE_TABLE_COLUMNS, ID_COLUMN + " = ?", new String[]{caseId.toString()}, null, null, null, null); List vaccines = readAllVaccines(cursor); if (!vaccines.isEmpty()) { @@ -443,7 +448,7 @@ public void close(Long caseId) { try { ContentValues values = new ContentValues(); values.put(SYNC_STATUS, TYPE_Synced); - getWritableDatabase().update(VACCINE_TABLE_NAME, values, ID_COLUMN + " = ?", new String[] {caseId.toString()}); + getWritableDatabase().update(VACCINE_TABLE_NAME, values, ID_COLUMN + " = ?", new String[]{caseId.toString()}); } catch (Exception e) { Log.e(TAG, Log.getStackTraceString(e)); } diff --git a/opensrp-immunization/src/main/java/org/smartregister/immunization/service/intent/VaccineIntentService.java b/opensrp-immunization/src/main/java/org/smartregister/immunization/service/intent/VaccineIntentService.java index 5bbb4f91..4be1ddea 100644 --- a/opensrp-immunization/src/main/java/org/smartregister/immunization/service/intent/VaccineIntentService.java +++ b/opensrp-immunization/src/main/java/org/smartregister/immunization/service/intent/VaccineIntentService.java @@ -24,6 +24,7 @@ public class VaccineIntentService extends IntentService { public static final String EVENT_TYPE = "Vaccination"; public static final String EVENT_TYPE_OUT_OF_CATCHMENT = "Out of Area Service - Vaccination"; + public static final String EVENT_TYPE_IS_VOIDED = "Void Event"; public static final String ENTITY_TYPE = "vaccination"; private static final String TAG = VaccineIntentService.class.getCanonicalName(); private VaccineRepository vaccineRepository; @@ -138,6 +139,10 @@ protected void onHandleIntent(Intent intent) { if (vaccine.getBaseEntityId() == null || vaccine.getBaseEntityId().isEmpty() || new Integer(1).equals(vaccine.getOutOfCatchment())) { JsonFormUtils.createVaccineEvent(getApplicationContext(), vaccine, getEventTypeOutOfCatchment(), getEntityType(), jsonArray); + } + if (vaccine.getBaseEntityId() == null || vaccine.getBaseEntityId().isEmpty() || new Integer(1).equals(vaccine.getOutOfCatchment())) { + JsonFormUtils.createVaccineEvent(getApplicationContext(), vaccine, getEventTypeIsVoided(), getEntityType(), jsonArray); + } vaccineRepository.close(vaccine.getId()); } @@ -155,6 +160,10 @@ protected String getEventTypeOutOfCatchment() { return EVENT_TYPE_OUT_OF_CATCHMENT; } + protected String getEventTypeIsVoided() { + return EVENT_TYPE_IS_VOIDED; + } + protected String getEntityType() { return ENTITY_TYPE; } diff --git a/opensrp-immunization/src/test/java/org/smartregister/immunization/domain/VaccineScheduleTest.java b/opensrp-immunization/src/test/java/org/smartregister/immunization/domain/VaccineScheduleTest.java index cdae053b..f73a977b 100644 --- a/opensrp-immunization/src/test/java/org/smartregister/immunization/domain/VaccineScheduleTest.java +++ b/opensrp-immunization/src/test/java/org/smartregister/immunization/domain/VaccineScheduleTest.java @@ -58,7 +58,7 @@ public class VaccineScheduleTest extends BaseUnitTest { private Vaccine newVaccine = new Vaccine(0l, VaccineTest.BASEENTITYID, VaccineTest.PROGRAMCLIENTID, magicOPV0, 0, new Date(), VaccineTest.ANMID, VaccineTest.LOCATIONID, VaccineTest.SYNCSTATUS, VaccineTest.HIA2STATUS, 0l, - VaccineTest.EVENTID, VaccineTest.FORMSUBMISSIONID, 0, new Date()); + VaccineTest.EVENTID, VaccineTest.FORMSUBMISSIONID, 0, new Date(), 1); @Before public void setUp() { @@ -157,7 +157,7 @@ public void testVaccineOrCondition() throws ParseException { list.add(new Vaccine(0l, VaccineTest.BASEENTITYID, VaccineTest.PROGRAMCLIENTID, "MCV 1", 0, sdf.parse("2020-01-28"), VaccineTest.ANMID, VaccineTest.LOCATIONID, VaccineTest.SYNCSTATUS, VaccineTest.HIA2STATUS, 0l, - VaccineTest.EVENTID, VaccineTest.FORMSUBMISSIONID, 0, new Date())); + VaccineTest.EVENTID, VaccineTest.FORMSUBMISSIONID, 0, new Date(), 1)); Condition object = new Condition(); object.type = "join"; diff --git a/opensrp-immunization/src/test/java/org/smartregister/immunization/domain/VaccineTest.java b/opensrp-immunization/src/test/java/org/smartregister/immunization/domain/VaccineTest.java index 94456b1b..45b88ab0 100644 --- a/opensrp-immunization/src/test/java/org/smartregister/immunization/domain/VaccineTest.java +++ b/opensrp-immunization/src/test/java/org/smartregister/immunization/domain/VaccineTest.java @@ -36,7 +36,7 @@ public void assertDefaultConstructorsCreateNonNullObjectOnInstantiation() { junit.framework.Assert.assertNotNull(new Vaccine(0l, BASEENTITYID, NAME, 0, new Date(), ANMID, LOCATIONID, SYNCSTATUS, HIA2STATUS, 0l, EVENTID, FORMSUBMISSIONID, 0)); junit.framework.Assert.assertNotNull(new Vaccine(0l, BASEENTITYID, PROGRAMCLIENTID, NAME, 0, new Date(), - ANMID, LOCATIONID, SYNCSTATUS, HIA2STATUS, 0l, EVENTID, FORMSUBMISSIONID, 0, new Date())); + ANMID, LOCATIONID, SYNCSTATUS, HIA2STATUS, 0l, EVENTID, FORMSUBMISSIONID, 0, new Date(), 1)); } @Test diff --git a/opensrp-immunization/src/test/java/org/smartregister/immunization/repository/RecurringServiceRecordRepositoryTest.java b/opensrp-immunization/src/test/java/org/smartregister/immunization/repository/RecurringServiceRecordRepositoryTest.java index 209447ff..32b567ce 100644 --- a/opensrp-immunization/src/test/java/org/smartregister/immunization/repository/RecurringServiceRecordRepositoryTest.java +++ b/opensrp-immunization/src/test/java/org/smartregister/immunization/repository/RecurringServiceRecordRepositoryTest.java @@ -70,7 +70,7 @@ public void assertInstantiatesSuccessfullyOnConstructorCall() { @Test public void verifyCreateTableCallsExecuteSQLMethod() { RecurringServiceRecordRepository.createTable(sqliteDatabase); - Mockito.verify(sqliteDatabase, Mockito.times(7)).execSQL(org.mockito.ArgumentMatchers.anyString()); + Mockito.verify(sqliteDatabase, Mockito.times(8)).execSQL(org.mockito.ArgumentMatchers.anyString()); } @Test diff --git a/opensrp-immunization/src/test/java/org/smartregister/immunization/repository/VaccineRepositoryTest.java b/opensrp-immunization/src/test/java/org/smartregister/immunization/repository/VaccineRepositoryTest.java index 8d9ffdad..6d513afa 100644 --- a/opensrp-immunization/src/test/java/org/smartregister/immunization/repository/VaccineRepositoryTest.java +++ b/opensrp-immunization/src/test/java/org/smartregister/immunization/repository/VaccineRepositoryTest.java @@ -154,7 +154,7 @@ public void verifyaddTestShouldCallInsertAndUpdate1Time() { Vaccine newVaccine = new Vaccine(0l, VaccineTest.BASEENTITYID, VaccineTest.PROGRAMCLIENTID, VaccineTest.NAME, 0, new Date(), VaccineTest.ANMID, VaccineTest.LOCATIONID, VaccineTest.SYNCSTATUS, VaccineTest.HIA2STATUS, 0l, - VaccineTest.EVENTID, VaccineTest.FORMSUBMISSIONID, 0, new Date()); + VaccineTest.EVENTID, VaccineTest.FORMSUBMISSIONID, 0, new Date(), 1); VaccineRepository vaccineRepositoryspy = Mockito.spy(vaccineRepository); Vaccine vaccineToReturn = Mockito.mock(Vaccine.class); @@ -186,11 +186,12 @@ public void testReadAllReturnsListOfVaccines(){ VaccineRepository.CREATED_AT, VaccineRepository.TEAM, VaccineRepository.TEAM_ID, - VaccineRepository.CHILD_LOCATION_ID + VaccineRepository.CHILD_LOCATION_ID, + VaccineRepository.IS_VOIDED }; MatrixCursor cursor = new MatrixCursor(columns); - cursor.addRow(new Object[]{1l, "", "", magicName, magic10, magicTime, "", "", "", "", 1l, "", "", 1,magicTime,"","",""}); + cursor.addRow(new Object[]{1l, "", "", magicName, magic10, magicTime, "", "", "", "", 1l, "", "", 1,magicTime,"","","", 1}); List vaccines = vaccineRepository.readAllVaccines(cursor); Assert.assertFalse(vaccines.isEmpty()); diff --git a/opensrp-immunization/src/test/java/org/smartregister/immunization/service/intent/VaccineIntentServiceRoboTest.java b/opensrp-immunization/src/test/java/org/smartregister/immunization/service/intent/VaccineIntentServiceRoboTest.java index ed31b199..20abf7e3 100644 --- a/opensrp-immunization/src/test/java/org/smartregister/immunization/service/intent/VaccineIntentServiceRoboTest.java +++ b/opensrp-immunization/src/test/java/org/smartregister/immunization/service/intent/VaccineIntentServiceRoboTest.java @@ -58,8 +58,8 @@ public void onHandleIntentShouldGenerateValidJsonFieldsForEventCreation() { String baseEntityId = "9080s8dfdsc"; String anmId = "demo"; String locationId = "093209d-sdfds909"; - Vaccine opv1 = new Vaccine(3L, baseEntityId, "", "opv", 1, date, anmId, locationId, BaseRepository.TYPE_Unsynced, "", date.getTime(), "eventId1", "formSubmissionId1", 0, date); - Vaccine penta3 = new Vaccine(4L, baseEntityId, "", "penta", 3, date, anmId, locationId, BaseRepository.TYPE_Unsynced, "", date.getTime(), "eventId2", "formSubmissionId2", 0, date); + Vaccine opv1 = new Vaccine(3L, baseEntityId, "", "opv", 1, date, anmId, locationId, BaseRepository.TYPE_Unsynced, "", date.getTime(), "eventId1", "formSubmissionId1", 0, date, 1); + Vaccine penta3 = new Vaccine(4L, baseEntityId, "", "penta", 3, date, anmId, locationId, BaseRepository.TYPE_Unsynced, "", date.getTime(), "eventId2", "formSubmissionId2", 0, date, 1); List vaccineList = new ArrayList<>(); vaccineList.add(opv1); diff --git a/opensrp-immunization/src/test/java/org/smartregister/immunization/view/ImmunizationRowCardTest.java b/opensrp-immunization/src/test/java/org/smartregister/immunization/view/ImmunizationRowCardTest.java index 2e66e024..1f35812c 100644 --- a/opensrp-immunization/src/test/java/org/smartregister/immunization/view/ImmunizationRowCardTest.java +++ b/opensrp-immunization/src/test/java/org/smartregister/immunization/view/ImmunizationRowCardTest.java @@ -63,7 +63,7 @@ public void setUp() throws Exception { Vaccine vaccine = new Vaccine(0l, VaccineTest.BASEENTITYID, VaccineTest.PROGRAMCLIENTID, VaccineTest.NAME, 0, new Date(), VaccineTest.ANMID, VaccineTest.LOCATIONID, VaccineTest.SYNCSTATUS, VaccineTest.HIA2STATUS, 0l, - VaccineTest.EVENTID, VaccineTest.FORMSUBMISSIONID, 0, new Date()); + VaccineTest.EVENTID, VaccineTest.FORMSUBMISSIONID, 0, new Date(), 1); Event event = new Event(); event.setEventId("1"); event.setDateCreated(new DateTime()); diff --git a/sample/src/main/java/org/smartregister/immunization/sample/repository/SampleRepository.java b/sample/src/main/java/org/smartregister/immunization/sample/repository/SampleRepository.java index 39be3771..2aebd3ec 100644 --- a/sample/src/main/java/org/smartregister/immunization/sample/repository/SampleRepository.java +++ b/sample/src/main/java/org/smartregister/immunization/sample/repository/SampleRepository.java @@ -151,6 +151,9 @@ private void upgradeToVersion2(SQLiteDatabase db) { db.execSQL(VaccineRepository.UPDATE_TABLE_ADD_OUT_OF_AREA_COL); db.execSQL(VaccineRepository.UPDATE_TABLE_ADD_OUT_OF_AREA_COL_INDEX); + db.execSQL(VaccineRepository.UPDATE_TABLE_ADD_IS_VOIDED_COL); + db.execSQL(VaccineRepository.UPDATE_TABLE_ADD_IS_VOIDED_COL_INDEX); + //EventClientRepository.createTable(db, EventClientRepository.Table.path_reports, EventClientRepository.report_column.values()); db.execSQL(VaccineRepository.UPDATE_TABLE_ADD_HIA2_STATUS_COL);