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
|
// Render ideas
|
||||||
function renderIdeas() {
|
function renderIdeas() {
|
||||||
if (currentView === 'cards') {
|
sortIdeasByVotes();
|
||||||
renderCardsView();
|
if (currentView === 'cards') {
|
||||||
} else {
|
renderCardsView();
|
||||||
renderMatrixView();
|
} else {
|
||||||
}
|
renderMatrixView();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Render cards view
|
// Render cards view
|
||||||
function renderCardsView() {
|
function renderCardsView() {
|
||||||
@ -938,12 +939,17 @@
|
|||||||
renderIdeas();
|
renderIdeas();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Utility functions
|
// Utility functions
|
||||||
function generateUUID() {
|
function sortIdeasByVotes() {
|
||||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
if (!currentTour) return;
|
||||||
const r = Math.random() * 16 | 0;
|
currentTour.ideas.sort((a, b) => b.voters.length - a.voters.length);
|
||||||
const v = c === 'x' ? r : (r & 0x3 | 0x8);
|
}
|
||||||
return v.toString(16);
|
|
||||||
|
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