diff --git a/.github/workflows/build_upload.yml b/.github/workflows/build_upload.yml index f770d8a31..e1e4071b7 100644 --- a/.github/workflows/build_upload.yml +++ b/.github/workflows/build_upload.yml @@ -4,6 +4,7 @@ on: branches: - master - 'release-*' + - BAH-3266-test tags: - '[0-9]+.[0-9]+.[0-9]+' paths-ignore: diff --git a/openmrs/obscalculator/BahmniObsValueCalculator.groovy b/openmrs/obscalculator/BahmniObsValueCalculator.groovy index 91a4a0e86..3b00b148b 100644 --- a/openmrs/obscalculator/BahmniObsValueCalculator.groovy +++ b/openmrs/obscalculator/BahmniObsValueCalculator.groovy @@ -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; @@ -26,6 +27,8 @@ public class BahmniObsValueCalculator implements ObsValueCalculator { static Double BMI_SEVERELY_OBESE = 40.0; static Double ZERO = 0.0; static Map obsParentMap = new HashMap(); + static def logger = new File(OpenmrsUtil.getApplicationDataDirectory() + "groovy_debug.txt") + public static enum BmiStatus { VERY_SEVERELY_UNDERWEIGHT("Very Severely Underweight"), @@ -231,7 +234,16 @@ public class BahmniObsValueCalculator implements ObsValueCalculator { } static BahmniObservation createObs(String conceptName, BahmniObservation parent, BahmniEncounterTransaction encounterTransaction, Date obsDatetime) { + logger.append 'Create Obs\n' def concept = Context.getConceptService().getConceptByName(conceptName) + logger.append concept + logger.append 'Create Obs ' + Context.getLocale() + '\n' + if (StringUtils.isEmpty(concept) && !LocaleUtility.getDefaultLocale().equals(Context.getLocale())) { + def conceptsByName = Context.getConceptService().getConceptsByName(conceptName, LocaleUtility.getDefaultLocale(), false); + if (!StringUtils.isEmpty(concept)) { + concept = conceptsByName[0]; + } + } BahmniObservation newObservation = new BahmniObservation() newObservation.setConcept(new EncounterTransaction.Concept(concept.getUuid(), conceptName)) newObservation.setObservationDateTime(obsDatetime);