Merge pull request #2 from ok2/codex/sort-ideas-by-number-of-votes-desc

Sort ideas by vote count
This commit is contained in:
Kiyomichi Kosaka 2025-06-08 16:55:44 +02:00 committed by GitHub
commit bede2873ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -801,6 +801,7 @@
// Render ideas
function renderIdeas() {
sortIdeasByVotes();
if (currentView === 'cards') {
renderCardsView();
} else {
@ -939,6 +940,11 @@
}
// 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;