Permalink
Browse files

#10 Randomly shuffle games in active jam.

  • Loading branch information...
1 parent baedb78 commit 2336901b5783037fb2d1a84bf99f3c1f3bc24322 Matthew Bowra-Dean committed with Sep 5, 2011
Showing with 7 additions and 1 deletion.
  1. +6 −0 flamejam/models.py
  2. +1 −1 flamejam/templates/show_jam.html
View
@@ -6,6 +6,7 @@
from flamejam import app, db, filters
from flask import url_for, Markup
import re
+import random
# rating:
# Participant <one2many> RatingSkip <many2one> Entry
@@ -202,6 +203,11 @@ def getTopEntries(self):
e.sort(cmp = entryCompare)
return e
+ def getShuffledEntries(self):
+ e = list(self.entries.all())
+ random.shuffle(e)
+ return e
+
def entryCompare(left, right):
x = right.getTotalScore() - left.getTotalScore()
if x > 0:
@@ -76,7 +76,7 @@ <h2>Entries</h2>
<p>There are no entries yet.</p>
{% else %}
<ul>
- {% for entry in jam.entries %}
+ {% for entry in jam.getShuffledEntries() %}
<li class="box floatingbox" style="width: 164px;">
<h4><a href="{{ entry.url() }}">{{ entry.title }}</a></h4>

0 comments on commit 2336901

Please sign in to comment.