diff options
author | Frederick Muriuki Muriithi | 2024-05-31 14:36:30 -0500 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-05-31 14:36:30 -0500 |
commit | 6460ff889bdeac659f1e7aa0c4d1e9e7d5030001 (patch) | |
tree | 33bece4b242be853ba303cd0489c3223413b9c61 /issues | |
parent | 5c9bd36af9f69594682401054e915bf09979a092 (diff) | |
download | gn-gemtext-6460ff889bdeac659f1e7aa0c4d1e9e7d5030001.tar.gz |
GN2: New issue: Sort data by attributes.
Diffstat (limited to 'issues')
-rw-r--r-- | issues/genenetwork2/sort-by-attributes.gmi | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/issues/genenetwork2/sort-by-attributes.gmi b/issues/genenetwork2/sort-by-attributes.gmi new file mode 100644 index 0000000..68ef2ce --- /dev/null +++ b/issues/genenetwork2/sort-by-attributes.gmi @@ -0,0 +1,40 @@ +# Sort by Attributes + +## Tags + +* assigned: zachs, fredm +* type: feature-request, feature request +* priority: high +* status: open +* keywords: genenetwork2, sorting, attributes + +## Description + +From the email: + + +> This trait: +> +> https://genenetwork.org/show_trait?trait_id=L2229-L8228&dataset=Duke_UTHSC_ConnStrgROIs4zlog2_0524 +> +> I want to sort by the attribute Age, from youngest to oldest but all of the NULL values are treated as the lowest value. I would much prefer sorting to ignore these empty fields.. + +Javascript is weird, and we'd have to do something like the following to sort with ages: + +``` +myarr.toSorted((a, b) => { + if(a == null) {/*isNumber(null) = true*/ + return 1; + } + if(b == null) { + return -1; + } + if(isNumber(a) && isNumber(b)) { + return a - b; + } +}); +``` + +to ensure that null values always come last. + +Mixed lists are going to have to be sorted in alphabetical order, I guess, while still ensuring nulls end up last with something like the above. |