Skip to content

Commit

Permalink
Merge pull request #95 from dhis2/develop_with_pull
Browse files Browse the repository at this point in the history
 Release of version 0.5.8
  • Loading branch information
MarinaCape authored Aug 7, 2018
2 parents a66a982 + 3aa086d commit 5e320e1
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 56 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ apply plugin: 'jacoco-android'
android {

compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
Expand Down Expand Up @@ -72,6 +71,7 @@ android {
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
buildToolsVersion '27.0.3'
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ private boolean validate() {
getContext().getString(org.hisp.dhis.android.trackercapture.R.string.profile_form_empty));
return false;
}
if(!validateUniqueValues(form.getTrackedEntityAttributeValueMap())){
List<String> listOfUniqueInvalidFields = getNotValidatedUniqueValues(form.getTrackedEntityAttributeValueMap());
if(!TrackerController.validateUniqueValues(form.getTrackedEntityAttributeValueMap(), form.getOrganisationUnit().getId())){
List<String> listOfUniqueInvalidFields = TrackerController.getNotValidatedUniqueValues(form.getTrackedEntityAttributeValueMap(), form.getOrganisationUnit().getId());
String listOfInvalidAttributes = " ";
for(String value:listOfUniqueInvalidFields){
listOfInvalidAttributes += value + " ";
Expand Down Expand Up @@ -372,45 +372,6 @@ private boolean validate() {
}
}

private List<String> getNotValidatedUniqueValues(
Map<String, TrackedEntityAttributeValue> trackedEntityAttributeValueMap) {
List<String> listOFUniqueFields = new ArrayList<>();
for (String key : trackedEntityAttributeValueMap.keySet()) {
TrackedEntityAttributeValue value = trackedEntityAttributeValueMap.get(key);
TrackedEntityAttribute trackedEntityAttribute =
MetaDataController.getTrackedEntityAttribute(
value.getTrackedEntityAttributeId());
if (trackedEntityAttribute.isUnique()) {
if(value.getValue()==null || value.getValue().isEmpty()){
continue;
}
if (TrackerController.countTrackedEntityAttributeValue(value)!=0) {
listOFUniqueFields.add(trackedEntityAttribute.getDisplayName());
}
}
}
return listOFUniqueFields;
}

private boolean validateUniqueValues(
Map<String, TrackedEntityAttributeValue> trackedEntityAttributeValueMap) {
for (String key : trackedEntityAttributeValueMap.keySet()) {
TrackedEntityAttributeValue value = trackedEntityAttributeValueMap.get(key);
TrackedEntityAttribute trackedEntityAttribute =
MetaDataController.getTrackedEntityAttribute(
value.getTrackedEntityAttributeId());
if (trackedEntityAttribute.isUnique()) {
if(value.getValue()==null || value.getValue().isEmpty()){
continue;
}
if(TrackerController.countTrackedEntityAttributeValue(value) !=0){
return false;
}
}
}
return true;
}

private boolean isMapEmpty(
Map<String, TrackedEntityAttributeValue> trackedEntityAttributeValueMap) {
boolean isEmpty = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,11 @@ public EnrollmentDataEntryFragmentForm query(Context context) {
for (int i = 0; i < programTrackedEntityAttributes.size(); i++) {
boolean editable = true;
boolean shouldNeverBeEdited = false;
ValueType valueType = programTrackedEntityAttributes.get(i).getTrackedEntityAttribute().getValueType();
if (programTrackedEntityAttributes.get(i).getTrackedEntityAttribute().isGenerated()) {
editable = false;
shouldNeverBeEdited = true;
valueType = ValueType.TEXT;
mFragment.getListViewAdapter().disableIndex(programTrackedEntityAttributes.get(
i).getTrackedEntityAttribute().getUid());
}
Expand All @@ -178,8 +180,7 @@ public EnrollmentDataEntryFragmentForm query(Context context) {
programTrackedEntityAttributes.get(i).getTrackedEntityAttribute().getName(),
getTrackedEntityDataValue(programTrackedEntityAttributes.get(i).
getTrackedEntityAttribute().getUid(), trackedEntityAttributeValues),
programTrackedEntityAttributes.get(
i).getTrackedEntityAttribute().getValueType(),
valueType,
editable, shouldNeverBeEdited, isRadioButton);
dataEntryRows.add(row);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@
import org.hisp.dhis.android.sdk.controllers.metadata.MetaDataController;
import org.hisp.dhis.android.sdk.controllers.tracker.TrackerController;
import org.hisp.dhis.android.sdk.persistence.loaders.DbLoader;
import org.hisp.dhis.android.sdk.persistence.models.Enrollment;
import org.hisp.dhis.android.sdk.persistence.models.ProgramRule;
import org.hisp.dhis.android.sdk.persistence.models.ProgramTrackedEntityAttribute;
import org.hisp.dhis.android.sdk.persistence.models.TrackedEntityAttributeValue;
import org.hisp.dhis.android.sdk.persistence.models.TrackedEntityInstance;
import org.hisp.dhis.android.sdk.ui.activities.OnBackPressedListener;
import org.hisp.dhis.android.sdk.ui.adapters.SectionAdapter;
import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.DataEntryRow;
import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.DataEntryRowTypes;
import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.Row;
import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.RunProgramRulesEvent;
import org.hisp.dhis.android.sdk.ui.adapters.rows.events.OnDetailedInfoButtonClick;
Expand All @@ -65,7 +65,6 @@
import org.hisp.dhis.android.sdk.ui.fragments.dataentry.RefreshListViewEvent;
import org.hisp.dhis.android.sdk.ui.fragments.dataentry.RowValueChangedEvent;
import org.hisp.dhis.android.sdk.ui.fragments.dataentry.SaveThread;
import org.hisp.dhis.android.sdk.utils.ScreenSizeConfigurator;
import org.hisp.dhis.android.sdk.utils.UiUtils;
import org.hisp.dhis.android.trackercapture.R;

Expand Down Expand Up @@ -245,6 +244,13 @@ public void onLoadFinished(Loader<TrackedEntityInstanceProfileFragmentForm> load
form = data;
listViewAdapter.swapData(form.getDataEntryRows());
programRuleFragmentHelper.mapFieldsToRulesAndIndicators();
if (data.getDataEntryRows() != null && !data.getDataEntryRows().isEmpty()) {
listViewAdapter.swapData(data.getDataEntryRows());
}
if (data.getProgram().getProgramRules() != null &&
!data.getProgram().getProgramRules().isEmpty()) {
initiateEvaluateProgramRules();
}
}
}

Expand Down Expand Up @@ -482,6 +488,18 @@ private boolean validate() {
if(dataEntryRow.getValidationError()!=null)
validationErrors.add(getContext().getString(dataEntryRow.getValidationError()));
}

if(!TrackerController.validateUniqueValues(form.getTrackedEntityAttributeValueMap(), form.getTrackedEntityInstance().getOrgUnit())){
List<String> listOfUniqueInvalidFields = TrackerController.getNotValidatedUniqueValues(form.getTrackedEntityAttributeValueMap(), form.getTrackedEntityInstance().getOrgUnit());
String listOfInvalidAttributes = " ";
for(String value:listOfUniqueInvalidFields){
listOfInvalidAttributes += value + " ";
}
UiUtils.showErrorDialog(getActivity(), getContext().getString(org.hisp.dhis.android.trackercapture.R.string.error_message),
String.format(getContext().getString(org.hisp.dhis.android.trackercapture.R.string.invalid_unique_value_form_empty), listOfInvalidAttributes));
return false;
}

if (programRulesValidationErrors.isEmpty() && allErrors.isEmpty() && validationErrors.isEmpty()) {
return true;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.hisp.dhis.android.sdk.persistence.models.TrackedEntityInstance;
import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.DataEntryRowFactory;
import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.Row;
import org.hisp.dhis.android.sdk.utils.Utils;
import org.hisp.dhis.android.sdk.utils.api.ValueType;

import java.util.ArrayList;
Expand Down Expand Up @@ -90,6 +91,21 @@ public TrackedEntityInstanceProfileFragmentForm query(Context context) {
return mForm;
}
mForm.setTrackedEntityAttributeValues(trackedEntityAttributeValues);

List<Enrollment> enrollments = TrackerController.getEnrollments(mProgramId, mTrackedEntityInstance);
Enrollment activeEnrollment = null;
if(enrollments!=null) {
for(Enrollment enrollment: enrollments) {
if(enrollment.getStatus().equals(Enrollment.ACTIVE)) {
activeEnrollment = enrollment;
}
}
}
if (activeEnrollment==null) {
return mForm;
}


List<Row> dataEntryRows = new ArrayList<>();
for (int i = 0; i < programTrackedEntityAttributes.size(); i++) {
boolean shouldNeverBeEdited = false;
Expand Down Expand Up @@ -125,6 +141,8 @@ public TrackedEntityInstanceProfileFragmentForm query(Context context) {
trackedEntityAttributeValue);
}
}
activeEnrollment.setAttributes(trackedEntityAttributeValues);
mForm.setEnrollment(activeEnrollment);
mForm.setDataEntryRows(dataEntryRows);
return mForm;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public void applyShowErrorRuleAction(ProgramRuleAction programRuleAction) {

@Override
public void applyHideFieldRuleAction(ProgramRuleAction programRuleAction, List<String> affectedFieldsWithValue) {
fragment.getListViewAdapter().hideIndex(programRuleAction.getDataElement());
fragment.getListViewAdapter().hideIndex(programRuleAction.getTrackedEntityAttribute());
if (fragment.containsValue(getDataElementValue(programRuleAction.getDataElement()))) {
affectedFieldsWithValue.add(programRuleAction.getDataElement());
}
Expand Down
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.raizlabs:Griddle:1.0.3'
classpath 'io.fabric.tools:gradle:1.25.1'
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.1'
Expand All @@ -33,18 +33,18 @@ ext {
minSdkVersion = 15
compileSdkVersion = 23
targetSdkVersion = 23
versionCode = 64
versionName = "0.5.6"
versionCode = 67
versionName = "0.5.8"

configuration = [
package : "org.hisp.dhis.android.trackercapture",
applicationId : "org.hisp.dhis.android.trackercapture",
buildToolsVersion: "26.0.2",
minSdkVersion : 15,
compileSdkVersion: 23,
targetSdkVersion : 23,
versionCode : 64,
versionName : "0.5.6"
targetSdkVersion : 26,
versionCode : 66,
versionName : "0.5.8"
]

libraries = [
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Feb 09 12:35:04 CET 2018
#Wed Jul 11 09:14:23 CEST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
2 changes: 1 addition & 1 deletion sdk
Submodule sdk updated 56 files
+2 −1 build.gradle
+15 −11 core/build.gradle
+34 −6 core/src/main/java/org/hisp/dhis/android/sdk/controllers/DhisController.java
+2 −1 core/src/main/java/org/hisp/dhis/android/sdk/controllers/DhisService.java
+19 −18 core/src/main/java/org/hisp/dhis/android/sdk/controllers/UserController.java
+116 −27 core/src/main/java/org/hisp/dhis/android/sdk/controllers/metadata/MetaDataController.java
+78 −0 core/src/main/java/org/hisp/dhis/android/sdk/controllers/tracker/TrackerController.java
+152 −48 core/src/main/java/org/hisp/dhis/android/sdk/controllers/tracker/TrackerDataLoader.java
+93 −41 core/src/main/java/org/hisp/dhis/android/sdk/controllers/tracker/TrackerDataSender.java
+4 −3 core/src/main/java/org/hisp/dhis/android/sdk/controllers/wrappers/AssignedProgramsWrapper.java
+1 −1 core/src/main/java/org/hisp/dhis/android/sdk/controllers/wrappers/ProgramWrapper.java
+25 −16 core/src/main/java/org/hisp/dhis/android/sdk/network/APIException.java
+101 −96 core/src/main/java/org/hisp/dhis/android/sdk/network/DhisApi.java
+51 −39 core/src/main/java/org/hisp/dhis/android/sdk/network/RepoManager.java
+2 −2 core/src/main/java/org/hisp/dhis/android/sdk/network/ResponseHolder.java
+2 −1 core/src/main/java/org/hisp/dhis/android/sdk/network/Session.java
+6 −0 core/src/main/java/org/hisp/dhis/android/sdk/persistence/Dhis2Application.java
+1 −1 core/src/main/java/org/hisp/dhis/android/sdk/persistence/Dhis2Database.java
+32 −0 ...a/org/hisp/dhis/android/sdk/persistence/migrations/version19/Version19MigrationAddOrganisationUnitCode.java
+15 −0 core/src/main/java/org/hisp/dhis/android/sdk/persistence/models/Access.java
+63 −0 core/src/main/java/org/hisp/dhis/android/sdk/persistence/models/Data.java
+25 −0 core/src/main/java/org/hisp/dhis/android/sdk/persistence/models/EventsPager.java
+12 −2 core/src/main/java/org/hisp/dhis/android/sdk/persistence/models/OrganisationUnit.java
+23 −0 core/src/main/java/org/hisp/dhis/android/sdk/persistence/models/Pager.java
+5 −0 core/src/main/java/org/hisp/dhis/android/sdk/persistence/models/Program.java
+12 −0 core/src/main/java/org/hisp/dhis/android/sdk/persistence/models/SystemInfo.java
+13 −2 core/src/main/java/org/hisp/dhis/android/sdk/persistence/models/TrackedEntityAttributeGeneratedValue.java
+8 −2 core/src/main/java/org/hisp/dhis/android/sdk/persistence/models/TrackedEntityInstance.java
+28 −8 core/src/main/java/org/hisp/dhis/android/sdk/persistence/models/UserAccount.java
+2 −1 core/src/main/java/org/hisp/dhis/android/sdk/persistence/preferences/LastUpdatedManager.java
+23 −11 core/src/main/java/org/hisp/dhis/android/sdk/synchronization/data/common/ARemoteDataSource.java
+22 −5 core/src/main/java/org/hisp/dhis/android/sdk/synchronization/data/enrollment/EnrollmentRemoteDataSource.java
+46 −8 core/src/main/java/org/hisp/dhis/android/sdk/synchronization/data/event/EventRemoteDataSource.java
+40 −6 ...hisp/dhis/android/sdk/synchronization/data/trackedentityinstance/TrackedEntityInstanceRemoteDataSource.java
+13 −9 core/src/main/java/org/hisp/dhis/android/sdk/synchronization/domain/common/Synchronizer.java
+0 −4 core/src/main/java/org/hisp/dhis/android/sdk/synchronization/domain/event/EventSynchronizer.java
+4 −3 core/src/main/java/org/hisp/dhis/android/sdk/ui/activities/LoginActivity.java
+1 −1 core/src/main/java/org/hisp/dhis/android/sdk/ui/adapters/rows/dataentry/DatePickerRow.java
+10 −2 core/src/main/java/org/hisp/dhis/android/sdk/ui/adapters/rows/dataentry/EnrollmentDatePickerRow.java
+8 −1 core/src/main/java/org/hisp/dhis/android/sdk/ui/adapters/rows/dataentry/IncidentDatePickerRow.java
+18 −11 core/src/main/java/org/hisp/dhis/android/sdk/ui/adapters/rows/dataentry/StatusRow.java
+9 −1 core/src/main/java/org/hisp/dhis/android/sdk/ui/adapters/rows/events/OnCompleteEventClick.java
+12 −6 core/src/main/java/org/hisp/dhis/android/sdk/ui/dialogs/ItemStatusDialogFragment.java
+0 −1 core/src/main/java/org/hisp/dhis/android/sdk/ui/fragments/common/AbsProgramRuleFragment.java
+2 −0 core/src/main/java/org/hisp/dhis/android/sdk/ui/fragments/eventdataentry/EventDataEntryFragment.java
+2 −1 core/src/main/java/org/hisp/dhis/android/sdk/ui/fragments/settings/SettingsFragment.java
+11 −9 core/src/main/java/org/hisp/dhis/android/sdk/utils/NetworkUtils.java
+16 −7 core/src/main/java/org/hisp/dhis/android/sdk/utils/StringConverter.java
+1 −0 core/src/main/java/org/hisp/dhis/android/sdk/utils/api/ContextVariableType.java
+44 −0 ...src/main/java/org/hisp/dhis/android/sdk/utils/serializers/TrackedEntityInstanceTrackedEntitySerializer.java
+63 −5 core/src/main/java/org/hisp/dhis/android/sdk/utils/services/VariableService.java
+12 −3 core/src/main/res/layout/eventlayout.xml
+11 −0 core/src/main/res/layout/listview_row_status.xml
+1 −0 core/src/main/res/values-es/strings.xml
+1 −0 core/src/main/res/values/strings.xml
+1 −1 ui/build.gradle

0 comments on commit 5e320e1

Please sign in to comment.