Skip to content

Commit

Permalink
#867 - Handled not passing of in memory filter when custom filters ar…
Browse files Browse the repository at this point in the history
…e not used.
  • Loading branch information
petmongrels committed Feb 10, 2023
1 parent f387040 commit 6d36dee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions packages/openchs-android/src/service/CustomFilterService.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,13 @@ class CustomFilterService extends BaseService {
filterForFixedWidgetType(latestEncounters, schemaName, selectedAnswerFilters, indFunc, inMemoryFilter) {
//cannot append next filtered to this query because sorting happens at the end of query and we will not get expected result.
//so we get the most recent encounters from above query and pass it down to the next query.
return _.isEmpty(latestEncounters) ? [] : [...latestEncounters
//check if selected filter is present in the observations
.filtered(` ${selectedAnswerFilters()} `)
.filterInternal((obsHolder) => inMemoryFilter(obsHolder))
.map(indFunc)
];
if (_.isEmpty(latestEncounters)) return [];
let encountersBasedOnSelectedAnswers = latestEncounters.filtered(` ${selectedAnswerFilters()} `);
if (!_.isNil(inMemoryFilter)) {
General.logDebug("CustomFilterService", "Running in memory filter");
encountersBasedOnSelectedAnswers = encountersBasedOnSelectedAnswers.filterInternal((obsHolder) => inMemoryFilter(obsHolder))
}
return encountersBasedOnSelectedAnswers.map(indFunc);
}

filterForRangeWidgetType(latestEntities, selectedAnswerFilters, indFunc) {
Expand Down
2 changes: 1 addition & 1 deletion packages/openchs-android/src/service/SyncService.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class SyncService extends BaseService {

// Even blank dataServerSync with no data in or out takes quite a while.
// Don't do it twice if no image sync required
console.log('mediaUploadRequired', mediaUploadRequired);
General.logDebug('mediaUploadRequired', mediaUploadRequired);
const isManualSync = updatedSyncSource === SyncService.syncSources.SYNC_BUTTON;
const isOnlyUploadRequired = updatedSyncSource === SyncService.syncSources.ONLY_UPLOAD_BACKGROUND_JOB;
return mediaUploadRequired ?
Expand Down

0 comments on commit 6d36dee

Please sign in to comment.