Allow unit-aware sort when doses expressed as concentrations

This commit is contained in:
RunasSudo 2023-02-10 23:46:36 +11:00
parent eb40e2a950
commit 16a47cbb3a
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
1 changed files with 4 additions and 4 deletions

View File

@ -250,17 +250,17 @@
let num2 = parseInt(bits2[i]);
// Check for units - convert to grams
if (bits1.length > i + 1 && bits1[i + 1] == 'microgram') {
if (bits1.length > i + 1 && (bits1[i + 1] == 'microgram' || bits1[i + 1].startsWith('microgram/'))) {
num1 /= 1000000;
}
if (bits1.length > i + 1 && bits1[i + 1] == 'mg') {
if (bits1.length > i + 1 && (bits1[i + 1] == 'mg' || bits1[i + 1].startsWith('mg/'))) {
num1 /= 1000;
}
if (bits2.length > i + 1 && bits2[i + 1] == 'microgram') {
if (bits2.length > i + 1 && (bits2[i + 1] == 'microgram' || bits2[i + 1].startsWith('microgram/'))) {
num2 /= 1000000;
}
if (bits2.length > i + 1 && bits2[i + 1] == 'mg') {
if (bits2.length > i + 1 && (bits2[i + 1] == 'mg' || bits2[i + 1].startsWith('mg/'))) {
num2 /= 1000;
}