forked from keokilee/makahiki
-
Notifications
You must be signed in to change notification settings - Fork 5
Activity Page Design
yongwen edited this page Mar 28, 2011
·
8 revisions
Activity Page Code Walkthrough
- data model
- admin
- data flow
- header
- scoreboard
- Smart grid game
- source
- parameters
- categories : categories_list = __get_categories(user) code:
## return the category list with the tasks info
def __get_categories(user):
categories = Category.objects.all()
for cat in categories:
task_list = []
for task in cat.activitybase_set.all():
task.is_unlock = is_unlock(user, task)
task.is_pau = is_pau(user, task)
task_list.append(task)
cat.task_list = task_list
return categories
- Task page
- source
- parameters:
"task" : activity object
"type" : is event or not
"pau" : is pau
"approved" : is approved
"form" : input form for the task
"question" : activity question if any
"member_all" : number of person completed the task
"member_floor": number of person of the floor completed the task
- Events
- source
- parameters:
- events = get_available_events(user)
def get_available_events(user):
"""Retrieves only the events that a user can participate in."""
events = Activity.objects.exclude(
activitymember__user=user,
).filter(
type='event',
pub_date__lte=datetime.date.today(),
expire_date__gte=datetime.date.today(),
).order_by("priority", "title")
return events # Filters out inactive activities.
-
unlocking
-
Tests