Skip to content

Commit 1ddc07c

Browse files
Merge 24.11 to 25.3
2 parents ccb3f7f + b5a5ebc commit 1ddc07c

4 files changed

Lines changed: 8 additions & 16 deletions

File tree

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@labkey-martyp

ehr/resources/web/ehr/DataEntryUtils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ EHR.DataEntryUtils = new function(){
728728
type: 'labkey-store',
729729
schemaName: 'ehr_lookups',
730730
queryName: 'drug_defaults',
731-
columns: 'code,code/meaning,dosage,dosage_units,concentration,conc_units,amount,amount_units,amount_rounding,volume,vol_units,volume_rounding,route,frequency,duration,remark,offset',
731+
columns: 'code,code/meaning,dosage,dosage_units,concentration,conc_units,amount,amount_units,amount_rounding,volume,vol_units,volume_rounding,route,frequency,frequency/meaning,duration,remark,offset',
732732
sort: 'code',
733733
storeId: storeId,
734734
autoLoad: true,
@@ -874,7 +874,7 @@ EHR.DataEntryUtils = new function(){
874874
}
875875
}
876876

877-
if (!amount && Ext4.isEmpty(rounding)){
877+
if (amount && !Ext4.isEmpty(rounding)){
878878
amount = EHR.Utils.roundToNearest(amount, rounding);
879879
}
880880

ehr/resources/web/ehr/utils.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -497,19 +497,9 @@ EHR.Utils = new function(){
497497
return val;
498498
}
499499

500-
var remainder = val % round;
501-
var remainderPct = remainder / round;
502-
var base = Math.floor(val / round);
503-
if (remainder === 0){
504-
return val;
505-
}
506-
//note: JS seems to handle division poorly in situations like 4 / 0.1
507-
else if (remainderPct < 0.5 || remainderPct > 0.9999){
508-
return (base * round);
509-
}
510-
else {
511-
return (base * round) + round;
512-
}
500+
let rounded = Math.round(val / round) * round;
501+
let precision = (round.toString().split('.')[1] || "").length; // Get decimal places in `round`
502+
return rounded.toFixed(precision); // toFixed handles floating point precision issues
513503
},
514504

515505
editUIButtonCore: function(schemaName, queryName, dataRegionName, paramMap, copyFilters, params){

ehr/resources/web/ehr/window/DrugAmountWindow.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,8 @@ Ext4.define('EHR.window.DrugAmountWindow', {
394394
found = true;
395395
editor = {
396396
xtype: 'ldk-numberfield',
397-
fieldName: fieldName
397+
fieldName: fieldName,
398+
decimalPrecision: 6
398399
}
399400
}
400401

0 commit comments

Comments
 (0)