Skip to content

Commit

Permalink
BAH-3266 | Siva Reddy | Fetching concepts from default locale if no c…
Browse files Browse the repository at this point in the history
…oncepts in requested locale
  • Loading branch information
sivareddyp committed Nov 17, 2023
1 parent 3359332 commit ed2a5ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build_upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
branches:
- master
- 'release-*'
- BAH-3266-test
tags:
- '[0-9]+.[0-9]+.[0-9]+'
paths-ignore:
Expand Down
7 changes: 7 additions & 0 deletions openmrs/obscalculator/BahmniObsValueCalculator.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import org.openmrs.api.context.Context;
import org.openmrs.module.bahmniemrapi.obscalculator.ObsValueCalculator;
import org.openmrs.module.bahmniemrapi.encountertransaction.contract.BahmniEncounterTransaction
import org.openmrs.module.emrapi.encounter.domain.EncounterTransaction;
import org.openmrs.util.LocaleUtility;

import org.joda.time.LocalDate;
import org.joda.time.Months;
Expand Down Expand Up @@ -232,6 +233,12 @@ public class BahmniObsValueCalculator implements ObsValueCalculator {

static BahmniObservation createObs(String conceptName, BahmniObservation parent, BahmniEncounterTransaction encounterTransaction, Date obsDatetime) {
def concept = Context.getConceptService().getConceptByName(conceptName)
if (concept == null && !LocaleUtility.getDefaultLocale().equals(Context.getLocale())) {
List<Concept> conceptsByName = Context.getConceptService().getConceptsByName(conceptName, LocaleUtility.getDefaultLocale(), false);
if (!conceptsByName.isEmpty()) {
concept = conceptsByName[0];
}
}
BahmniObservation newObservation = new BahmniObservation()
newObservation.setConcept(new EncounterTransaction.Concept(concept.getUuid(), conceptName))
newObservation.setObservationDateTime(obsDatetime);
Expand Down

0 comments on commit ed2a5ca

Please sign in to comment.