Esempio n. 1
0
def profile():
    # Generate a list, myBootablesIdsWithPledgeOptions, of Bootable project ID's that have
    # PledgeOptions attached to them and so are launchable.
    myPledgeOptions=db((db.PledgeOptions.bootable_id == db.Bootables.id) & \
         (db.Bootables.user_id == auth.user.id)).select()
    myBootablesIdsWithPledgeOptions = []
    for pledgeOption in myPledgeOptions:
        myBootablesIdsWithPledgeOptions.append(pledgeOption.Bootables.id)

    myPledgeOptionsAndRewards = db(
         (db.BootablesWithTotalPledged.id == db.RewardsForEachPledgeOption.bootable_id) & \
         (db.Pledges.user_id == auth.user.id) & \
         (db.BootablesWithTotalPledged.state == db.States.id) & \
         (db.RewardsForEachPledgeOption.pledgeOption_id == db.Pledges.pledge_id)).select()
    myPledgeOptionsAndRewards = notNone(myPledgeOptionsAndRewards)

    myBootables = db(
       (db.BootablesWithTotalPledged.category==db.Categories.id) & \
       (db.BootablesWithTotalPledged.user_id == auth.user.id) & \
       (db.BootablesWithTotalPledged.state == db.States.id)).select()
    myBootables = notNone(myBootables)

    return dict(
        numberOfPledges=getNumberOfPledges(),
        totalPledged=getAmountPledged(),
        myBootablesIdsWithPledgeOptions=myBootablesIdsWithPledgeOptions,
        myPledgeOptionsAndRewards=myPledgeOptionsAndRewards,
        myBootables=myBootables)
Esempio n. 2
0
def profile():
	# Generate a list, myBootablesIdsWithPledgeOptions, of Bootable project ID's that have
	# PledgeOptions attached to them and so are launchable.
	myPledgeOptions=db((db.PledgeOptions.bootable_id == db.Bootables.id) & \
						(db.Bootables.user_id == auth.user.id)).select()
	myBootablesIdsWithPledgeOptions = []
	for pledgeOption in myPledgeOptions:
		myBootablesIdsWithPledgeOptions.append(pledgeOption.Bootables.id)

	myPledgeOptionsAndRewards = db(
						(db.BootablesWithTotalPledged.id == db.RewardsForEachPledgeOption.bootable_id) & \
						(db.Pledges.user_id == auth.user.id) & \
						(db.BootablesWithTotalPledged.state == db.States.id) & \
						(db.RewardsForEachPledgeOption.pledgeOption_id == db.Pledges.pledge_id)).select()
	myPledgeOptionsAndRewards=notNone(myPledgeOptionsAndRewards)
						
	myBootables = db(
				(db.BootablesWithTotalPledged.category==db.Categories.id) & \
				(db.BootablesWithTotalPledged.user_id == auth.user.id) & \
				(db.BootablesWithTotalPledged.state == db.States.id)).select()
	myBootables=notNone(myBootables)
	
	return dict(
			numberOfPledges=getNumberOfPledges(),
			totalPledged=getAmountPledged(),
			myBootablesIdsWithPledgeOptions=myBootablesIdsWithPledgeOptions,
			myPledgeOptionsAndRewards=myPledgeOptionsAndRewards,
			myBootables=myBootables)
Esempio n. 3
0
def index():
	newestFiveBootables = db(db.BootablesWithTotalPledged.state == 0).select(orderby=~db.BootablesWithTotalPledged.dateCreated)[0:5]
	newestFiveBootables.compact = False
	newestFiveBootables = notNone(newestFiveBootables)
	
	closestFiveToFunded = db(
						(db.BootablesWithTotalPledged.state == 0) & \
						((db.BootablesWithTotalPledged.percentageComplete < 100) |
						(db.BootablesWithTotalPledged.percentageComplete == None))).select(orderby=~db.BootablesWithTotalPledged.percentageComplete)[0:5]
	closestFiveToFunded.compact = False
	closestFiveToFunded = notNone(closestFiveToFunded)
	
	return dict(newestFiveBootables=newestFiveBootables,
				closestFiveToFunded=closestFiveToFunded)
Esempio n. 4
0
def view():
	bootable = db((db.BootablesWithTotalPledged.category==db.Categories.id) & \
		(db.BootablesWithTotalPledged.id == request.args(0))).select()
	bootable=notNone(bootable)
	bootable=notNone(bootable).first()
		
	possiblePledgeOptions = db(
		(db.PledgeOptions.bootable_id==request.args(0))).select()
	processedPossiblePledges = []
	for possiblePledgeOption in possiblePledgeOptions:
		pledgeWithRewards = db(
			(db.PledgeRewardPairs.pledgeOption_id==possiblePledgeOption.id) & \
			(db.PledgeRewardPairs.reward_id==db.Rewards.id)).select()
		rewards=[]
		for row in pledgeWithRewards:
			rewards.append(row.Rewards.reward)
		processedPossiblePledges.append({
									'pledgeOption_id':possiblePledgeOption.id,
									'price':possiblePledgeOption.price,
									'pledgeTitle':possiblePledgeOption.pledgeTitle,
									'rewards':rewards
									})
		
	usersAndPledges = db((db.Bootables.id==db.PledgeOptions.bootable_id) & \
		(db.Bootables.id == request.args(0)) & \
		(db.Pledges.user_id == db.auth_user.id) & \
		(db.Pledges.pledge_id == db.PledgeOptions.id)).select()
	
	userIsLoggedIn = False
	if (auth.user != None):
		userIsLoggedIn=True
		
	pledgesFromThisUserForThisBootable=None
	if (userIsLoggedIn):
		pledgesFromThisUserForThisBootableQuery = db((db.Bootables.id==db.PledgeOptions.bootable_id) & \
			(db.Bootables.id == request.args(0)) & \
			(db.Pledges.user_id == db.auth_user.id) & \
			(db.Pledges.user_id == auth.user.id) & \
			(db.Pledges.pledge_id == db.PledgeOptions.id)).select()
		if (len(pledgesFromThisUserForThisBootableQuery)>0):
			pledgesFromThisUserForThisBootable = pledgesFromThisUserForThisBootableQuery[0]
	
	return dict(
		bootable=bootable,
		processedPossiblePledges=processedPossiblePledges,
		usersAndPledges=usersAndPledges,
		userIsLoggedIn=userIsLoggedIn,
		pledgesFromThisUserForThisBootable=pledgesFromThisUserForThisBootable,
	)
Esempio n. 5
0
def search():
	searchTerm="%"+request.vars.searchTerm+"%"
	# TODO - add search for shortDescription as well, these items should be lower priority though.  Sort by date created.
	bootables = db(
				(db.BootablesWithTotalPledged.state >= 0) & \
				(db.BootablesWithTotalPledged.title.like(searchTerm))).select()
	bootables.compact = False
	bootables=notNone(bootables)
	return dict(bootables=bootables)
Esempio n. 6
0
def category():
	bootables = db((db.BootablesWithTotalPledged.category==db.Categories.id) & (db.Categories.category == request.args(0))).select()
	bootables=notNone(bootables)
	return dict(bootables=bootables)