Sort ideas by vote count
This commit is contained in:
parent
f077bf1f0f
commit
0d4a4d8ef2
@ -801,6 +801,7 @@
|
|||||||
|
|
||||||
// Render ideas
|
// Render ideas
|
||||||
function renderIdeas() {
|
function renderIdeas() {
|
||||||
|
sortIdeasByVotes();
|
||||||
if (currentView === 'cards') {
|
if (currentView === 'cards') {
|
||||||
renderCardsView();
|
renderCardsView();
|
||||||
} else {
|
} else {
|
||||||
@ -939,6 +940,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Utility functions
|
// Utility functions
|
||||||
|
function sortIdeasByVotes() {
|
||||||
|
if (!currentTour) return;
|
||||||
|
currentTour.ideas.sort((a, b) => b.voters.length - a.voters.length);
|
||||||
|
}
|
||||||
|
|
||||||
function generateUUID() {
|
function generateUUID() {
|
||||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
||||||
const r = Math.random() * 16 | 0;
|
const r = Math.random() * 16 | 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user