This project contains an applications that runs a swiss style tournament.
This is the basic version of the final assignment for the Introduction to Relational Databases Udacity course. No extra credit criterias have been met in this version.
Please refer to the vagrant/doc/ folder for an overview of the code and what it does. Version 1.0.
Filen name | Description |
---|---|
tournament.sql | This is the database where matches and players are recorded and stored. |
tournament.py | This file is the Python file containing the functions that executes the tournament. |
tournament_test.py | This file contains the unit_tests provided by Udacity |
Vagrant. Please follow the Vagrant installation guide before proceeding.
Paste the following in your terminal(make sure to have navigated to where you want to clone the repository):
git clone https://github.com/zackgus/tournament.git
cd tournament/vagrant/
vagrant up
How to create the database:
psql -f tournament.sql
This will drop the existing database and create a new, empty database.
Here are some example code. The exmple below is run in the Python shell in this projects Vagrant folder:
>>> import tournament
>>> tournament.register_player('player_one')
>>> tournament.register_player('player_two')
>>> tournament.swiss_pairings()
[(2, 'player_two', 1, 'player_one')]
To run the unit tests manually, simply log in to the Vagrant VM by typing the following in your terminal. Make sure you're in the correct folder:
cd tournament/vagrant/
Then sign in to the Vagrant VM:
vagrant ssh
Then navigate to the this projects folder:
cd /vagrant/tournament
python tournament_test.py
SQL functions: http://www.postgresql.org/docs/9.4/static/xfunc-sql.html