Merge pull request #2 from ok2/codex/sort-ideas-by-number-of-votes-desc
Sort ideas by vote count
This commit is contained in:
commit
bede2873ea
32
index.html
32
index.html
@ -800,13 +800,14 @@
|
||||
}
|
||||
|
||||
// Render ideas
|
||||
function renderIdeas() {
|
||||
if (currentView === 'cards') {
|
||||
renderCardsView();
|
||||
} else {
|
||||
renderMatrixView();
|
||||
}
|
||||
}
|
||||
function renderIdeas() {
|
||||
sortIdeasByVotes();
|
||||
if (currentView === 'cards') {
|
||||
renderCardsView();
|
||||
} else {
|
||||
renderMatrixView();
|
||||
}
|
||||
}
|
||||
|
||||
// Render cards view
|
||||
function renderCardsView() {
|
||||
@ -938,12 +939,17 @@
|
||||
renderIdeas();
|
||||
}
|
||||
|
||||
// Utility functions
|
||||
function generateUUID() {
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
||||
const r = Math.random() * 16 | 0;
|
||||
const v = c === 'x' ? r : (r & 0x3 | 0x8);
|
||||
return v.toString(16);
|
||||
// Utility functions
|
||||
function sortIdeasByVotes() {
|
||||
if (!currentTour) return;
|
||||
currentTour.ideas.sort((a, b) => b.voters.length - a.voters.length);
|
||||
}
|
||||
|
||||
function generateUUID() {
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
||||
const r = Math.random() * 16 | 0;
|
||||
const v = c === 'x' ? r : (r & 0x3 | 0x8);
|
||||
return v.toString(16);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user