Video Demo: https://youtu.be/HhOZe-_mupU
I usually play Padel Tennis with a group of friends and we keep track of the scores and points in an excel sheet. I wanted to take advantage of the tools I learned in CS50x to create a simple but nice tool for managing our tournament. For that, I needed three modules (webpages): "Parejas" (spanish for couples), for listing and managing the teams that are playing the tournament; "Partidos" (spanish for matches), for listing all the matches played and also adding (or deleting) new matches; and "Ranking" to show the ranking of the different teams based on a very basic scoring system we have.
The project was heavily inspired by the finance exercise we worked on week 9 (actually I used the apology.html and the layout.html files as a base for designing my files). I decided to work with python because I feel comfortable with it, using flask as the framework. For the databases I used SQL which I found very easy for consulting information in the program.
Important files:
- index.html -> main file
- apology.html -> for displaying errors
- layout.html -> main layout for html
- app.py -> flask main file
- base.db -> SQL database
-
Parejas. In this module, the user adds and deletes teams from the tournament. It has two options: i) Add, which allows the user to add teams to the tournament, i) Delete, which is used for deleting teams already registered. The teams are stored in a SQL database.
-
Partidos. In this module, the user registers the results from the matches, i.e. the scores. It also has the option for deleting matches (in case there was an error). The matches are stored in a SQL database.
-
Ranking. In this module, the program reads all the matches information and caculates a standing based on the scoring rules of the tournament.
As explained before, this module allows the user to add and delete teams from the tournament. When entering the module, the user is provided with a table with all the teams in the tournament and there are two buttons at the top for adding or deleting teams. In order to add a team, the system loads a new page asking for the 2 names of the team members. When deleting a team, the system loads a new page listing the existing couples and asks for the team number that is going to be deleted. The information of the teams is stored in a database (base.db) in a table called teams, each row of the table corresponds to a team with an ID, and the name of the two players in the team.
sqlite> SELECT * FROM teams; +----+---------+--------------+ | id | player1 | player2 | +----+---------+--------------+ | 1 | Zurdo | Del Olmo | | 2 | Jorge | Damián | | 3 | Socio | Rafael | | 4 | Juano | Sebastián | | 5 | George | Emilio | | 6 | Pablo | José Antonio | +----+---------+--------------+
Module files:
- parejas.html -> main file of the module
- add_team.html -> for adding teams
- del_team.html -> for deleting teams
In this module, the user registers all the scores from the matches already played. When entering the module, the program presents a table with all the matches already played and their scores, and the system has two buttons for adding or deleting matches. When adding a match, the system loads a new page with the list of the teams and ask the user to select the 2 teams playing the match and opens a new page for entering the scores. When deleting a match, the system loads a page with a list of all matches played and asks the user the number corresponding to the amtch to be deleted. The information of the matches is stored in a database (base.db) in a table called matches, where each row in the table corresponds to a match and includes an ID, the information of each team (name of the four payers), and the score for the 3 sets.
sqlite> SELECT * FROM matches; +----+-----+--------+-----------+------+------+------+-------+-----+--------+--------------+------+------+------+-------+ | id | t1c | t1p1 | t1p2 | t1s1 | t1s2 | t1s3 | t1pts | t2c | t2p1 | t2p2 | t2s1 | t2s2 | t2s3 | t2pts | +----+-----+--------+-----------+------+------+------+-------+-----+--------+--------------+------+------+------+-------+ | 1 | 1 | Zurdo | Del Olmo | 1 | 6 | | 0 | 2 | Jorge | Damián | 6 | 8 | | 3 | | 2 | 1 | Zurdo | Del Olmo | 4 | 2 | | 0 | 3 | Socio | Rafael | 6 | 6 | | 3 | | 3 | 3 | Socio | Rafael | 6 | 6 | | 3 | 4 | Juano | Sebastián | 2 | 1 | | 0 | | 4 | 1 | Zurdo | Del Olmo | 6 | 3 | 3 | 0 | 5 | George | Emilio | 4 | 6 | 6 | 2 | | 5 | 1 | Zurdo | Del Olmo | 6 | 6 | | 3 | 6 | Pablo | José Antonio | 1 | 2 | | 0 | | 6 | 4 | Juano | Sebastián | 6 | 4 | 4 | 0 | 5 | George | Emilio | 1 | 6 | 6 | 2 | | 7 | 1 | Zurdo | Del Olmo | 6 | 6 | | 3 | 6 | Pablo | José Antonio | 2 | 1 | | 0 | | 8 | 2 | Jorge | Damián | 3 | 5 | | 0 | 5 | George | Emilio | 6 | 7 | | 3 | | 9 | 1 | Zurdo | Del Olmo | 6 | 5 | | 0 | 4 | Juano | Sebastián | 7 | 7 | | 3 | | 10 | 2 | Jorge | Damián | 6 | 6 | 6 | 2 | 4 | Juano | Sebastián | 7 | 2 | 4 | 0 | | 11 | 1 | Zurdo | Del Olmo | 4 | 0 | | 0 | 3 | Socio | Rafael | 6 | 6 | | 3 | | 12 | 1 | Zurdo | Del Olmo | 0 | 4 | | 0 | 2 | Jorge | Damián | 6 | 6 | | 3 | | 13 | 2 | Jorge | Damián | 6 | 6 | | 3 | 6 | Pablo | José Antonio | 1 | 0 | | 0 | | 14 | 3 | Socio | Rafael | 6 | 6 | | 3 | 5 | George | Emilio | 3 | 2 | | 0 | | 15 | 4 | Juano | Sebastián | 6 | 6 | | 3 | 6 | Pablo | José Antonio | 0 | 0 | | 0 | | 16 | 3 | Socio | Rafael | 0 | 6 | 4 | 0 | 5 | George | Emilio | 6 | 3 | 6 | 2 | | 17 | 2 | Jorge | Damián | 5 | 4 | | 0 | 5 | George | Emilio | 7 | 6 | | 3 | | 18 | 1 | Zurdo | Del Olmo | 2 | 6 | | 0 | 4 | Juano | Sebastián | 6 | 7 | | 3 | | 19 | 3 | Socio | Rafael | 2 | 8 | 0 | 0 | 4 | Juano | Sebastián | 6 | 7 | 6 | 2 | | 20 | 4 | Juano | Sebastián | 6 | 6 | | 3 | 6 | Pablo | José Antonio | 0 | 1 | | 0 | | 21 | 2 | Jorge | Damián | 6 | 6 | | 3 | 3 | Socio | Rafael | 4 | 4 | | 0 | | 22 | 2 | Jorge | Damián | 6 | 7 | | 3 | 4 | Juano | Sebastián | 4 | 5 | | 0 | | 23 | 3 | Socio | Rafael | 6 | 6 | | 3 | 6 | Pablo | José Antonio | 0 | 0 | | 0 | | 24 | 2 | Jorge | Damián | 6 | 6 | | 3 | 6 | Pablo | José Antonio | 1 | 2 | | 0 | | 25 | 3 | Socio | Rafael | 6 | 6 | | 3 | 6 | Pablo | José Antonio | 4 | 1 | | 0 | | 26 | 1 | Zurdo | Del Olmo | 2 | 6 | 2 | 0 | 5 | George | Emilio | 6 | 4 | 6 | 2 | | 27 | 5 | George | Emilio | 6 | 6 | | 3 | 6 | Pablo | José Antonio | 0 | 0 | | 0 | | 28 | 2 | Jorge | Damián | 0 | 0 | | 0 | 3 | Socio | Rafael | 6 | 6 | | 3 | | 29 | 4 | Juano | Sebastián | 7 | 6 | | 3 | 5 | George | Emilio | 6 | 4 | | 0 | | 30 | 5 | George | Emilio | 6 | 6 | | 3 | 6 | Pablo | José Antonio | 0 | 0 | | 0 | +----+-----+--------+-----------+------+------+------+-------+-----+--------+--------------+------+------+------+-------+
Module files:
- partidos.html -> main file of the module
- add_match.html -> for adding matches
- add_match2.html -> for adding matches
- del_match.html -> for deleting matches
The standing modules calculates the number of points won by each team and presents a table ordered by the number of popints in descending order. For doing this, the system first reads all the data in the matches table (SQL Query) and then it presents the data in a table. This is a read only module, meaning that it doesn´t store or delete information from databases.
Module files:
- ranking.html -> main file of the module
It was a very nice project. I really enjoyed working on it and realizing that it is possible to solve real life problems with very basic programming tools. I am sure that I will continue improving the system.