Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit 8990f66

Browse files
SORMAS-Foundation#3375 - Additional fixes
Fixed errors in DatabaseHelper, fixed campaign infrastructure data being synchronized even if the feature is disabled
1 parent ae95889 commit 8990f66

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

sormas-app/app/src/main/java/de/symeda/sormas/app/backend/common/DatabaseHelper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public static void clearTables(boolean clearInfrastructure) {
209209
TableUtils.clearTable(connectionSource, Outbreak.class);
210210
TableUtils.clearTable(connectionSource, SyncLog.class);
211211
TableUtils.clearTable(connectionSource, DiseaseClassificationCriteria.class);
212-
TableUtils.createTable(connectionSource, CampaignFormData.class);
212+
TableUtils.clearTable(connectionSource, CampaignFormData.class);
213213

214214
if (clearInfrastructure) {
215215
TableUtils.clearTable(connectionSource, User.class);
@@ -221,8 +221,8 @@ public static void clearTables(boolean clearInfrastructure) {
221221
TableUtils.clearTable(connectionSource, Community.class);
222222
TableUtils.clearTable(connectionSource, District.class);
223223
TableUtils.clearTable(connectionSource, Region.class);
224-
TableUtils.createTable(connectionSource, Campaign.class);
225-
TableUtils.createTable(connectionSource, CampaignFormMeta.class);
224+
TableUtils.clearTable(connectionSource, Campaign.class);
225+
TableUtils.clearTable(connectionSource, CampaignFormMeta.class);
226226

227227
ConfigProvider.init(instance.context);
228228
}

sormas-app/app/src/main/java/de/symeda/sormas/app/backend/infrastructure/InfrastructureHelper.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package de.symeda.sormas.app.backend.infrastructure;
22

3+
import de.symeda.sormas.api.feature.FeatureType;
34
import de.symeda.sormas.api.infrastructure.InfrastructureChangeDatesDto;
45
import de.symeda.sormas.api.infrastructure.InfrastructureSyncDto;
56
import de.symeda.sormas.app.backend.campaign.CampaignDtoHelper;
@@ -53,7 +54,9 @@ public static void handlePulledInfrastructureData(InfrastructureSyncDto infrastr
5354
DatabaseHelper.getFeatureConfigurationDao().delete(infrastructureData.getDeletedFeatureConfigurationUuids());
5455
new FeatureConfigurationDtoHelper()
5556
.handlePulledList(DatabaseHelper.getFeatureConfigurationDao(), infrastructureData.getFeatureConfigurations());
56-
new CampaignDtoHelper().handlePulledList(DatabaseHelper.getCampaignDao(), infrastructureData.getCampaigns());
57-
new CampaignFormMetaDtoHelper().handlePulledList(DatabaseHelper.getCampaignFormMetaDao(), infrastructureData.getCampaignFormMetas());
57+
if (!DatabaseHelper.getFeatureConfigurationDao().isFeatureDisabled(FeatureType.CAMPAIGNS)) {
58+
new CampaignDtoHelper().handlePulledList(DatabaseHelper.getCampaignDao(), infrastructureData.getCampaigns());
59+
new CampaignFormMetaDtoHelper().handlePulledList(DatabaseHelper.getCampaignFormMetaDao(), infrastructureData.getCampaignFormMetas());
60+
}
5861
}
5962
}

0 commit comments

Comments
 (0)