Sort unrestricted drugs before restricted ones

This commit is contained in:
RunasSudo 2023-01-17 20:17:54 +11:00
parent 07595d0ef9
commit 2398f75203
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
1 changed files with 5 additions and 1 deletions

View File

@ -161,7 +161,11 @@
}
}
return 0;
// Sort unrestricted, then restricted/streamlined, then authority required
const type1 = item1['restriction_flag'] === 'U' ? 0 : item1['restriction_flag'] === 'R' ? 1 : item1['restriction_flag'] === 'S' ? 1 : item1['streamlined_authorities'] > 0 ? 2 : 3;
const type2 = item2['restriction_flag'] === 'U' ? 0 : item2['restriction_flag'] === 'R' ? 1 : item2['restriction_flag'] === 'S' ? 1 : item2['streamlined_authorities'] > 0 ? 2 : 3;
return type1 - type2;
}
function execAsScalars(stmt) {