aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
authorMunyoki Kilyungi2024-09-02 19:30:21 +0300
committerBonfaceKilz2024-09-05 16:39:14 +0300
commit595afc87ecafd1ae68a83a9136aabcbc47cc583f (patch)
tree6ffc0ffe4a4c7252d1ec0e67347659085a12f782 /gn3
parent5111b97fc058915f6dc38061fb4d2011d731657f (diff)
downloadgenenetwork3-595afc87ecafd1ae68a83a9136aabcbc47cc583f.tar.gz
Sort the RIF history data in reverse order.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'gn3')
-rw-r--r--gn3/db/rdf/wiki.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/gn3/db/rdf/wiki.py b/gn3/db/rdf/wiki.py
index d8fd8c8..0ff4483 100644
--- a/gn3/db/rdf/wiki.py
+++ b/gn3/db/rdf/wiki.py
@@ -137,7 +137,7 @@ CONSTRUCT {
BIND (COALESCE(?email_, "") AS ?email) .
BIND (COALESCE(?species_, "") AS ?species) .
BIND (COALESCE(?category_, "") AS ?category) .
-} ORDER BY DESC(?version) DESC(?createTime)
+}
""").substitute(prefix=RDF_PREFIXES, comment_id=comment_id)
results = query_frame_and_compact(
query, WIKI_CONTEXT,
@@ -158,4 +158,9 @@ CONSTRUCT {
else:
result["pubmed_ids"] = []
result["version"] = int(result["version"])
+ # We manually sort the array, since somehow "ORDER BY" in the
+ # sparql query is jumbled up during framing and compacting. This
+ # operation isn't heavy since we don't get many versions per wiki
+ # entry.
+ results["data"] = sorted(data, key=lambda d: d["version"], reverse=True)
return results