Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
adamsanadi6 committed Nov 29, 2024
2 parents a3093a8 + f917ae8 commit 537377c
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 8 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,14 @@ appdb:=$(if $(appdb),$(appdb),../db/default.realm)

put_db: ## Apply realmdb from ../default.realm
adb push $(appdb) /data/data/${app_android_package_name}/files/default.realm
put-db: put_db

put-db-custom:
ifndef dbPath
@echo "Provde the variable dbPath"
exit 1
endif
adb push $(dbPath) /data/data/${app_android_package_name}/files/default.realm

put_db_force:
adb push $(appdb) /product/default.realm
Expand Down
14 changes: 7 additions & 7 deletions packages/openchs-android/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function getDashboardCache(service, dashboardUUID) {
}

function getDashboardFiltersHash(dashboard) {
const str = JSON.stringify(dashboard.filters.map((x) => x.filterConfig));
const str = JSON.stringify(dashboard.filters.filter(x => !x.voided).map((x) => x.filterConfig));
return new Hashes.MD5().hex(str);
}

Expand Down
10 changes: 10 additions & 0 deletions packages/openchs-android/src/service/CustomFilterService.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ class CustomFilterService extends BaseService {
&& filter.subjectTypeUUID === subjectTypeUUID);
}

shouldFilterBeHidden(filterConfigs, selectedValues, filterConfig) {
const subjectTypeFilterUUID = Object.keys(filterConfigs).find(key => filterConfigs[key].type === CustomFilter.type.SubjectType);
const subjectTypeFilterValue = selectedValues[subjectTypeFilterUUID];
const subjectTypeUUIDs = subjectTypeFilterValue ? subjectTypeFilterValue.subjectTypes.map(st => st.uuid) : [];
const type = filterConfig.type;
return (type !== CustomFilter.type.SubjectType && type !== CustomFilter.type.AsOnDate) &&
!!filterConfig.subjectType &&
!_.includes(subjectTypeUUIDs, filterConfig.subjectType.uuid);
}

queryEntity(schemaName, selectedAnswerQueryFunction, otherFilters, indFunc, includeVoided) {
const query = selectedAnswerQueryFunction();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class DashboardFilterService extends BaseService {
const filterConfig = new DashboardFilterConfig();
filterConfig.widget = obj.widget;
filterConfig.type = obj.type;
filterConfig.subjectType = this.findByUUID(obj.subjectTypeUUID, SubjectType.schema.name);
if (obj.type === CustomFilter.type.GroupSubject) {
filterConfig.groupSubjectTypeFilter = new GroupSubjectTypeFilter();
filterConfig.groupSubjectTypeFilter.subjectType = this.findByUUID(obj.groupSubjectTypeFilter.subjectTypeUUID, SubjectType.schema.name);
Expand Down
6 changes: 6 additions & 0 deletions packages/openchs-android/src/views/filter/FiltersViewV2.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import AddressLevelState from '../../action/common/AddressLevelsState';
import FormMetaDataSelect from "../common/formMetaData/FormMetaDataSelect";
import AddressLevelService from "../../service/AddressLevelService";
import NamedSelectableEntities from "../../model/NamedSelectableEntities";
import CustomFilterService from '../../service/CustomFilterService';

class GroupSubjectFilter extends AbstractComponent {
constructor(props, context) {
Expand Down Expand Up @@ -108,6 +109,7 @@ class FiltersViewV2 extends AbstractComponent {

constructor(props, context) {
super(props, context, Reducers.reducerKeys.filterActionV2);
this.customFilterService = context.getService(CustomFilterService);
}

viewName() {
Expand Down Expand Up @@ -164,6 +166,10 @@ class FiltersViewV2 extends AbstractComponent {
const filterValue = selectedValues[filter.uuid];
const filterError = filterErrors[filter.uuid];

if(this.customFilterService.shouldFilterBeHidden(filterConfigs, selectedValues, filterConfig)) {
return null;
}

switch (filterConfig.type) {
case CustomFilter.type.Gender:
return <GenderFilter selectedGenders={filterValue || []}
Expand Down

0 comments on commit 537377c

Please sign in to comment.