From: Ben Beltran Date: Mon, 6 Apr 2020 22:08:49 +0000 (+0200) Subject: Sort by votes X-Git-Url: https://git.r.bdr.sh/rbdr/crowdantine/commitdiff_plain/910bdeaeb023ed509452f9ff80bfbbf626b06fbc?ds=inline;hp=636c2ad49bd1a4cfdba7e8c6a75691819cc2fdc1 Sort by votes --- diff --git a/index.html b/index.html index bc3f8b6..d839fe2 100644 --- a/index.html +++ b/index.html @@ -45,7 +45,9 @@ const container = document.getElementById('proposals'); - parsedResponse.result.items.forEach((proposal) => { + parsedResponse.result.items + .sort((a, b) => b.total_occurrences - a.total_occurrences) + .forEach((proposal) => { container.appendChild(generateProposalHTML(proposal)); });