[web2py] Re: Trouble setting up database that chooses predefined options.

2013-12-30 Thread Dave S


On Saturday, December 28, 2013 7:18:27 AM UTC-8, Cliff wrote:

 Dave

 Just wanted to give you an update. I have it working for now and will play 
 with some other features in the future. I tried uploading it to GAE but it 
 was being a pain so I threw it on a old web page of mine. 

 https://crypto4games.com/bowlgames/https://crypto4games.com/bowlgames/default/stats


Congratulations!  I feel sorry for the people who picked Cincinnati.

/dps


 

 On Monday, December 23, 2013 3:26:46 PM UTC-5, Cliff wrote:

 Thanks Dave!

 You have been very helpful. I should be able to find my way from here. 
 Thanks again :)


 On Friday, December 20, 2013 2:46:56 PM UTC-5, Dave S wrote:


 On Thursday, December 19, 2013 9:06:27 PM UTC-8, Cliff wrote:

 Hi Dave

 Thanks for the reply! That was somewhat the path I was on. I like the 
 boolean idea. Where I am hung up now though is how I would list all the 
 bowl games on a page then update picks, like how i mentioned before. Would 
 I be able to use SQLFORM to do this? This is my database setup, i have 
 kept 
 it simple for now.


 As a start, you might look at Loic's answer he linked in to the other 
 thread.  Your database should be small enough that Anthony's concern won't 
 be a problem.
 
 http://stackoverflow.com/questions/20697034/how-can-i-join-3-tables-and-output-a-the-all-three-together-joined-in-web2py/20698864#20698864
 

 (I use SQLFORM in my current, but just for a simple table; the trickiest 
 thing I do is figuring out maxid so I can limit the range of the table.)
  


 db.define_table('persons', Field('person'), Field('email'))
 db.define_table('teams', Field('teamname'), Field('winner', 'boolean', 
 default=False))
 db.define_table('bowls', Field('name'), Field('team1', 'reference 
 teams'),Field('team2', 'reference teams'), Field('gametime', 'date')) 
 db.define_table('picks', Field('person', 'reference persons'), 
 Field('pick', 'reference teams'))
 db.persons.email.requires = IS_EMAIL()
 db.picks.person.requires = IS_IN_DB(db, db.persons.id, '%(person)s')
 db.bowls.team1.requires = IS_IN_DB(db, db.teams.id, '%(teamname)s')
 db.bowls.team2.requires = IS_IN_DB(db, db.teams.id, '%(teamname)s')

 On Thursday, December 19, 2013 2:30:20 PM UTC-5, Cliff wrote:

 Hello.

 General question here. Me and some friends guess who is going to win 
 NCAAF bowl games so I thought I would try and make an app for it. So I 
 started off making a table for users, games, picks. 

 Users - Person name | email
 bowls - Bowl name | team 1 | team 2 | time | winner
 picks -  person (reference user) | pick (reference unsure) 

 What I would like to do is make a page with an arg for user where I 
 can enter their picks and it store it in a DB for that user. An example 
 would be Bowl game 1: Team 1 vs Team 2 then a drop down list or radio 
 button to select the team. Bowl game 2: team 1 vs team 2 drop down list 
 to 
 select the team etc etc.. Then later be able to list what user is ahead 
 by 
 wins. What I am getting caught up with is how to setup my databases. 

 If someone could point me in the right direction I would greatly 
 appreciate it. 



 /dps

  



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Trouble setting up database that chooses predefined options.

2013-12-28 Thread Cliff
Dave

Just wanted to give you an update. I have it working for now and will play 
with some other features in the future. I tried uploading it to GAE but it 
was being a pain so I threw it on a old web page of mine. 

https://crypto4games.com/bowlgames/https://crypto4games.com/bowlgames/default/stats

On Monday, December 23, 2013 3:26:46 PM UTC-5, Cliff wrote:

 Thanks Dave!

 You have been very helpful. I should be able to find my way from here. 
 Thanks again :)


 On Friday, December 20, 2013 2:46:56 PM UTC-5, Dave S wrote:


 On Thursday, December 19, 2013 9:06:27 PM UTC-8, Cliff wrote:

 Hi Dave

 Thanks for the reply! That was somewhat the path I was on. I like the 
 boolean idea. Where I am hung up now though is how I would list all the 
 bowl games on a page then update picks, like how i mentioned before. Would 
 I be able to use SQLFORM to do this? This is my database setup, i have kept 
 it simple for now.


 As a start, you might look at Loic's answer he linked in to the other 
 thread.  Your database should be small enough that Anthony's concern won't 
 be a problem.
 
 http://stackoverflow.com/questions/20697034/how-can-i-join-3-tables-and-output-a-the-all-three-together-joined-in-web2py/20698864#20698864
 

 (I use SQLFORM in my current, but just for a simple table; the trickiest 
 thing I do is figuring out maxid so I can limit the range of the table.)
  


 db.define_table('persons', Field('person'), Field('email'))
 db.define_table('teams', Field('teamname'), Field('winner', 'boolean', 
 default=False))
 db.define_table('bowls', Field('name'), Field('team1', 'reference 
 teams'),Field('team2', 'reference teams'), Field('gametime', 'date')) 
 db.define_table('picks', Field('person', 'reference persons'), 
 Field('pick', 'reference teams'))
 db.persons.email.requires = IS_EMAIL()
 db.picks.person.requires = IS_IN_DB(db, db.persons.id, '%(person)s')
 db.bowls.team1.requires = IS_IN_DB(db, db.teams.id, '%(teamname)s')
 db.bowls.team2.requires = IS_IN_DB(db, db.teams.id, '%(teamname)s')

 On Thursday, December 19, 2013 2:30:20 PM UTC-5, Cliff wrote:

 Hello.

 General question here. Me and some friends guess who is going to win 
 NCAAF bowl games so I thought I would try and make an app for it. So I 
 started off making a table for users, games, picks. 

 Users - Person name | email
 bowls - Bowl name | team 1 | team 2 | time | winner
 picks -  person (reference user) | pick (reference unsure) 

 What I would like to do is make a page with an arg for user where I can 
 enter their picks and it store it in a DB for that user. An example would 
 be Bowl game 1: Team 1 vs Team 2 then a drop down list or radio button to 
 select the team. Bowl game 2: team 1 vs team 2 drop down list to select 
 the 
 team etc etc.. Then later be able to list what user is ahead by wins. What 
 I am getting caught up with is how to setup my databases. 

 If someone could point me in the right direction I would greatly 
 appreciate it. 



 /dps

  



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Trouble setting up database that chooses predefined options.

2013-12-23 Thread Cliff
Thanks Dave!

You have been very helpful. I should be able to find my way from here. 
Thanks again :)


On Friday, December 20, 2013 2:46:56 PM UTC-5, Dave S wrote:


 On Thursday, December 19, 2013 9:06:27 PM UTC-8, Cliff wrote:

 Hi Dave

 Thanks for the reply! That was somewhat the path I was on. I like the 
 boolean idea. Where I am hung up now though is how I would list all the 
 bowl games on a page then update picks, like how i mentioned before. Would 
 I be able to use SQLFORM to do this? This is my database setup, i have kept 
 it simple for now.


 As a start, you might look at Loic's answer he linked in to the other 
 thread.  Your database should be small enough that Anthony's concern won't 
 be a problem.
 
 http://stackoverflow.com/questions/20697034/how-can-i-join-3-tables-and-output-a-the-all-three-together-joined-in-web2py/20698864#20698864
 

 (I use SQLFORM in my current, but just for a simple table; the trickiest 
 thing I do is figuring out maxid so I can limit the range of the table.)
  


 db.define_table('persons', Field('person'), Field('email'))
 db.define_table('teams', Field('teamname'), Field('winner', 'boolean', 
 default=False))
 db.define_table('bowls', Field('name'), Field('team1', 'reference 
 teams'),Field('team2', 'reference teams'), Field('gametime', 'date')) 
 db.define_table('picks', Field('person', 'reference persons'), 
 Field('pick', 'reference teams'))
 db.persons.email.requires = IS_EMAIL()
 db.picks.person.requires = IS_IN_DB(db, db.persons.id, '%(person)s')
 db.bowls.team1.requires = IS_IN_DB(db, db.teams.id, '%(teamname)s')
 db.bowls.team2.requires = IS_IN_DB(db, db.teams.id, '%(teamname)s')

 On Thursday, December 19, 2013 2:30:20 PM UTC-5, Cliff wrote:

 Hello.

 General question here. Me and some friends guess who is going to win 
 NCAAF bowl games so I thought I would try and make an app for it. So I 
 started off making a table for users, games, picks. 

 Users - Person name | email
 bowls - Bowl name | team 1 | team 2 | time | winner
 picks -  person (reference user) | pick (reference unsure) 

 What I would like to do is make a page with an arg for user where I can 
 enter their picks and it store it in a DB for that user. An example would 
 be Bowl game 1: Team 1 vs Team 2 then a drop down list or radio button to 
 select the team. Bowl game 2: team 1 vs team 2 drop down list to select the 
 team etc etc.. Then later be able to list what user is ahead by wins. What 
 I am getting caught up with is how to setup my databases. 

 If someone could point me in the right direction I would greatly 
 appreciate it. 



 /dps

  


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Trouble setting up database that chooses predefined options.

2013-12-20 Thread Dave S

On Thursday, December 19, 2013 9:06:27 PM UTC-8, Cliff wrote:

 Hi Dave

 Thanks for the reply! That was somewhat the path I was on. I like the 
 boolean idea. Where I am hung up now though is how I would list all the 
 bowl games on a page then update picks, like how i mentioned before. Would 
 I be able to use SQLFORM to do this? This is my database setup, i have kept 
 it simple for now.


As a start, you might look at Loic's answer he linked in to the other 
thread.  Your database should be small enough that Anthony's concern won't 
be a problem.
http://stackoverflow.com/questions/20697034/how-can-i-join-3-tables-and-output-a-the-all-three-together-joined-in-web2py/20698864#20698864

(I use SQLFORM in my current, but just for a simple table; the trickiest 
thing I do is figuring out maxid so I can limit the range of the table.)
 


 db.define_table('persons', Field('person'), Field('email'))
 db.define_table('teams', Field('teamname'), Field('winner', 'boolean', 
 default=False))
 db.define_table('bowls', Field('name'), Field('team1', 'reference 
 teams'),Field('team2', 'reference teams'), Field('gametime', 'date')) 
 db.define_table('picks', Field('person', 'reference persons'), 
 Field('pick', 'reference teams'))
 db.persons.email.requires = IS_EMAIL()
 db.picks.person.requires = IS_IN_DB(db, db.persons.id, '%(person)s')
 db.bowls.team1.requires = IS_IN_DB(db, db.teams.id, '%(teamname)s')
 db.bowls.team2.requires = IS_IN_DB(db, db.teams.id, '%(teamname)s')

 On Thursday, December 19, 2013 2:30:20 PM UTC-5, Cliff wrote:

 Hello.

 General question here. Me and some friends guess who is going to win 
 NCAAF bowl games so I thought I would try and make an app for it. So I 
 started off making a table for users, games, picks. 

 Users - Person name | email
 bowls - Bowl name | team 1 | team 2 | time | winner
 picks -  person (reference user) | pick (reference unsure) 

 What I would like to do is make a page with an arg for user where I can 
 enter their picks and it store it in a DB for that user. An example would 
 be Bowl game 1: Team 1 vs Team 2 then a drop down list or radio button to 
 select the team. Bowl game 2: team 1 vs team 2 drop down list to select the 
 team etc etc.. Then later be able to list what user is ahead by wins. What 
 I am getting caught up with is how to setup my databases. 

 If someone could point me in the right direction I would greatly 
 appreciate it. 



/dps

 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Trouble setting up database that chooses predefined options.

2013-12-19 Thread Dave S


On Thursday, December 19, 2013 11:30:20 AM UTC-8, Cliff wrote:

 Hello.

 General question here. Me and some friends guess who is going to win NCAAF 
 bowl games so I thought I would try and make an app for it. So I started 
 off making a table for users, games, picks. 

 Users - Person name | email
 bowls - Bowl name | team 1 | team 2 | time | winner
 picks -  person (reference user) | pick (reference unsure) 


I'd add in a table of teams - id | school name | team name | visitor [ | 
colors | coach name | atheletic director name | BCS rank | other trivia]
(visitor can be a boolean, to pick which team is listed in the left drop 
down.)
(I don't know that you need to have a link back to the bowl in the team 
table; I'd skip doing that unless you figured out a specific need for it.)

(note, allow the DAL to setup IDs in each table, which will be referenced. 
 For instance, team1 in db.bowls will be a reference to teams.id)

db.picks.pick would also be a reference to teams.id.



 What I would like to do is make a page with an arg for user where I can 
 enter their picks and it store it in a DB for that user. An example would 
 be Bowl game 1: Team 1 vs Team 2 then a drop down list or radio button to 
 select the team. Bowl game 2: team 1 vs team 2 drop down list to select the 
 team etc etc.. Then later be able to list what user is ahead by wins. What 
 I am getting caught up with is how to setup my databases. 

 If someone could point me in the right direction I would greatly 
 appreciate it. 


I think the extra table for teams is the main change I would make.  Sounds 
like a fun project to do over the holiday weekend.  Be sure and let us know 
how it turned out and how your friends reacted.

(Next year's goal:  moblile app client for your friends' phones)

/dps

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Trouble setting up database that chooses predefined options.

2013-12-19 Thread Dave S


On Thursday, December 19, 2013 6:29:33 PM UTC-8, Dave S wrote:



 On Thursday, December 19, 2013 11:30:20 AM UTC-8, Cliff wrote:

 Hello.

 General question here. Me and some friends guess who is going to win 
 NCAAF bowl games so I thought I would try and make an app for it. So I 
 started off making a table for users, games, picks. 

 Users - Person name | email
 bowls - Bowl name | team 1 | team 2 | time | winner
 picks -  person (reference user) | pick (reference unsure) 


 I'd add in a table of teams - id | school name | team name | visitor [ | 
 colors | coach name | atheletic director name | BCS rank | other trivia]
 (visitor can be a boolean, to pick which team is listed in the left drop 
 down.)
 (I don't know that you need to have a link back to the bowl in the team 
 table; I'd skip doing that unless you figured out a specific need for it.)

 (note, allow the DAL to setup IDs in each table, which will be referenced. 
  For instance, team1 in db.bowls will be a reference to teams.id)

 db.picks.pick would also be a reference to teams.id.



 What I would like to do is make a page with an arg for user where I can 
 enter their picks and it store it in a DB for that user. An example would 
 be Bowl game 1: Team 1 vs Team 2 then a drop down list or radio button to 
 select the team. Bowl game 2: team 1 vs team 2 drop down list to select the 
 team etc etc.. Then later be able to list what user is ahead by wins. What 
 I am getting caught up with is how to setup my databases. 


Oops, I think you need at least 1 field in the bowls table to indicate the 
winner.  One way of doing it would be a boolean homevictor to indicate 
that the home team won.  Hmmm, maybe 2 booleans, the other one being 
gameover.  I think your counting of user victories would be a join of 
their picks and the bowl victory counts, but I'm an 90 pound SQL weakling, 
so maybe Niphlod, Alan, or Anthony will provide a clearer picture of that.
 

 If someone could point me in the right direction I would greatly 
 appreciate it. 


 I think the extra table for teams is the main change I would make.  Sounds 
 like a fun project to do over the holiday weekend.  Be sure and let us know 
 how it turned out and how your friends reacted.

 (Next year's goal:  moblile app client for your friends' phones)


/dps
 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Trouble setting up database that chooses predefined options.

2013-12-19 Thread Cliff
Hi Dave

Thanks for the reply! That was somewhat the path I was on. I like the 
boolean idea. Where I am hung up now though is how I would list all the 
bowl games on a page then update picks, like how i mentioned before. Would 
I be able to use SQLFORM to do this? This is my database setup, i have kept 
it simple for now.


db.define_table('persons', Field('person'), Field('email'))
db.define_table('teams', Field('teamname'), Field('winner', 'boolean', 
default=False))
db.define_table('bowls', Field('name'), Field('team1', 'reference 
teams'),Field('team2', 'reference teams'), Field('gametime', 'date')) 
db.define_table('pickss', Field('person', 'reference persons'), 
Field('pick', 'reference teams'))
db.persons.email.requires = IS_EMAIL()
db.picks.person.requires = IS_IN_DB(db, db.persons.id, '%(person)s')
db.bowls.team1.requires = IS_IN_DB(db, db.teams.id, '%(teamname)s')
db.bowls.team2.requires = IS_IN_DB(db, db.teams.id, '%(teamname)s')

On Thursday, December 19, 2013 2:30:20 PM UTC-5, Cliff wrote:

 Hello.

 General question here. Me and some friends guess who is going to win NCAAF 
 bowl games so I thought I would try and make an app for it. So I started 
 off making a table for users, games, picks. 

 Users - Person name | email
 bowls - Bowl name | team 1 | team 2 | time | winner
 picks -  person (reference user) | pick (reference unsure) 

 What I would like to do is make a page with an arg for user where I can 
 enter their picks and it store it in a DB for that user. An example would 
 be Bowl game 1: Team 1 vs Team 2 then a drop down list or radio button to 
 select the team. Bowl game 2: team 1 vs team 2 drop down list to select the 
 team etc etc.. Then later be able to list what user is ahead by wins. What 
 I am getting caught up with is how to setup my databases. 

 If someone could point me in the right direction I would greatly 
 appreciate it. 


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.