Permalink
Browse files

fix username sort order

  • Loading branch information...
1 parent e09919a commit 5e68b909cab7b756e56e3809adaacf8ee4c799fd @artnez committed May 13, 2012
Showing with 5 additions and 3 deletions.
  1. +3 −1 src/faceoff/fixtures.py
  2. +2 −2 src/faceoff/models/user.py
@@ -147,7 +147,9 @@ def rand_users(min_count, max_count):
count = randint(min_count, max_count)
names.insert(0, ['a', 'rtnez'])
for n in range(count):
- nickname = names[n][0].lower() + names[n][1].lower()
+ fname = names[n][0].lower() if randint(0, 1) else names[n][0]
+ lname = names[n][1].lower() if randint(0, 1) else names[n][1]
+ nickname = fname + lname
rank = 'admin' if n < 2 else 'member'
yield {'nickname': nickname, 'password': 'faceoff!', 'rank': rank}
@@ -8,7 +8,7 @@
from random import choice
from time import time
from hashlib import sha1
-from faceoff.db import use_db
+from faceoff.db import use_db, Expr
RANK_ADMIN = 'admin'
RANK_MEMBER = 'member'
@@ -27,7 +27,7 @@ def get_all_users(db):
@use_db
def get_active_users(db):
- return search_users(db, sort='nickname', order='asc')
+ return search_users(db, sort=Expr('UPPER(nickname)'), order='asc')
@use_db
def create_user(db, nickname, password, rank=None):

0 comments on commit 5e68b90

Please sign in to comment.