Improve reduce functions of SQLite3 request

Steffen Mutter steffen at webanimations.de
Thu Feb 7 23:54:03 CET 2013


Dennis Lee Bieber wrote:

> On Thu, 7 Feb 2013 11:33:00 +0000 (UTC), Steffen Mutter
> <steffen at webanimations.de> declaimed the following in
> gmane.comp.python.general:
>> CREATE TABLE "Runde20122013" (
>
> 	Is that table name specifying a playing season?

Yes.

> What happens next
> season -- you create a new table and duplicate all the code or edit the
> code to use the new name (and lose all access to the previous seasons)?

Of course I create a new table for the next season, with exactly the
same code. (Okay, I will leave out those doubled 'Termin' column)

> 	The playing season should be a field in the table so that you don't
> have to change the application each year.

I prefer a table, because it's easy to drop or backup whenever I want
:-)


You really put much effort to improve my database design, so I print
this out and think about it later, what sounds practicable.

You were thinking about players in the team, and gamereport. 
So I will explain how I need to do it and how it is noted down during
the game.

To be a 'player' is just a role for a user.
Users and their personal data reside in the users table.
The role table represents the user permissions, what he can do.

The users table will have an ID for every user which will be generated
when a user registeres. To make it really unique and random (and not
too easy to remember) I'll create it like this: 
import uuid, OpenSSL
userID = uuid.UUID(bytes = OpenSSL.rand.bytes(16))

This userID is the primary, unique key which will be placed into other
tables. 
Now exact planning is needed, to normalize data to get all things
sorted in a way, the system can display a game (which will open, when
you click on the gamesID (Spiel).

So, 14 players join the game for each club, makes 28 players.
(Professional teams may have 16 which makes 32 players)  
Up to three teamleaders for each team,
a secretary and a timekeeper and the referee(s) (max 2).
The numbers of the players shirts may vary from game to game, to make it
more difficult. 

These are just the persons :-P
The secretary writes down the goal result every time a goal is scored.
(Professionals do this even with the goalgetter and the exact playing
time with their high-end equipment)

The amateur-stuff will look like this 
hometeam:guestteam 
Example, 
0:1, 1:1, 2:1, 3:1, 3:2, 3:3, 4:3, 4:4, 4:5...
 When a player gets amonitioned (yellow card) the minute is noted down
(round up 4:11 = 5th minute). When a player gets a 2 minute punishment
(still yellow card) the exact time is noted down, same with
disqualification (red card), with a ban for doing handball sports it
is exactly noted down what happend (this is not public and will be
taken to court) 
Example: referee Wilbur McDonald was attacked and knocked out by player
John Smith (No. 12 team Panic Poodles) after a discussion about a
decision of Mr McDonald. Mr John Smith is banned until further notice

All this data shall be displayed according to the status the user has.

Complex, hm :-) ?

So, what would be nice is to diplay the data for the game, when you
klick on the game-number. If you klick on a players name, its data would
be nice to show: Games played in the actual seasion games played in
life, goals scored , yellow cards, 2min punishmends and red cards and
persons banned for lifetime won't show up at all :-)
 BUT: only for those ersons who are allowed to see it: trainers
responsible for the team 
the player 
the other players in the team

By the way: no handall site offers actually this complex data, but it
would be very impressive if I could offer this.

Okay, but I think I will go to bed now and back to fix some bugs
tomorrow.



More information about the Python-list mailing list