Fix sorting relays by score

This commit is contained in:
Jon Staab
2024-03-22 15:32:01 -07:00
parent 86870e6fd7
commit bd3351d043
2 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "paravel", "name": "paravel",
"version": "0.5.6", "version": "0.5.7",
"description": "Yet another toolkit for nostr", "description": "Yet another toolkit for nostr",
"author": "hodlbod", "author": "hodlbod",
"license": "MIT", "license": "MIT",
+2 -1
View File
@@ -72,7 +72,8 @@ export class Router {
} }
const items = Object.entries(scores) const items = Object.entries(scores)
.sort((a, b) => a[1].score > b[1].score ? -1 : 1) .filter(([url, {score}]) => score > 0)
.sort((a, b) => b[1].score - a[1].score)
.map(([url, {score, count}]) => ({url, score, count})) .map(([url, {score, count}]) => ({url, score, count}))
return items return items