From 2398f752030a0f560b20af32e74129d265018b04 Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Tue, 17 Jan 2023 20:17:54 +1100 Subject: [PATCH] Sort unrestricted drugs before restricted ones --- html/index.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/html/index.html b/html/index.html index ef67377..4f38955 100644 --- a/html/index.html +++ b/html/index.html @@ -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) {