Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
466fb7f
Fix issue #1 : unknown email crashes app, add message in index template
Tit-Co Mar 9, 2026
9e1c454
File change : add unit tests
Tit-Co Mar 11, 2026
e37cc7e
Modification : fix issue #2 - club purchase places with not enough po…
Tit-Co Mar 11, 2026
e829ef6
Modification : fix issue #4 - clubs should not be able to book more t…
Tit-Co Mar 11, 2026
8c119e9
Modification : add improvement by checking negative number of places …
Tit-Co Mar 11, 2026
31f1863
Modification : fix issue #6 - points update not reflected, update uni…
Tit-Co Mar 12, 2026
50a648c
Modification : refactor code according to snake case
Tit-Co Mar 12, 2026
8ab253f
Modification : fix issue #4 - club should not be able to book more th…
Tit-Co Mar 13, 2026
a77fa81
Modification : fix issue #5 - booking places in past competitions sho…
Tit-Co Mar 13, 2026
d0bbbca
Modification : refactor unit tests
Tit-Co Mar 13, 2026
c9a89fc
Modification : fix issue #282 - clubs should not be able to book more…
Tit-Co Mar 14, 2026
aea1089
Modification : add improvement - message when competition is sold out…
Tit-Co Mar 14, 2026
24552f1
Modification : refactor unit tests with class
Tit-Co Mar 15, 2026
f93042d
Modification : add auth feature with password, add new template to si…
Tit-Co Mar 16, 2026
9bf3e24
Modification and file change : separate tests by unit and integration…
Tit-Co Mar 16, 2026
2441f12
Modification : protect routes with flask session
Tit-Co Mar 16, 2026
da2361e
Modification : update tests
Tit-Co Mar 16, 2026
05a72dc
File change and modification : implement points board feature in issu…
Tit-Co Mar 16, 2026
6ce9786
Modification : update tests for points board feature
Tit-Co Mar 17, 2026
a32d549
File change : init poetry
Tit-Co Mar 17, 2026
5978720
File change and modification : add functional tests
Tit-Co Mar 17, 2026
60b3862
File change ans modification : add performance tests with locust, upd…
Tit-Co Mar 17, 2026
d13a93d
Modification : update templates and add custom css
Tit-Co Mar 18, 2026
188c800
Modification : update server.py to check if form fields are empty, up…
Tit-Co Mar 18, 2026
e88f4e3
Modification : add club from session in board template if existing in…
Tit-Co Mar 19, 2026
d240bfd
File change and modification : update readme.md, add screenshots fold…
Tit-Co Mar 19, 2026
3f2291b
Modification : update readme.md
Tit-Co Mar 19, 2026
e2bbe71
Modification : refactor afetr code review
Tit-Co Mar 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ bin
include
lib
.Python
tests/
.envrc
__pycache__
__pycache__
.idea/
.coverage
237 changes: 210 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,234 @@
# gudlift-registration
# Flask App - OpenClassrooms Project 11
**Improve a web Flask app by testing and debugging**

1. Why
---

## DESCRIPTION

This is a proof of concept (POC) project to show a light-weight version of our competition booking platform. The aim is the keep things as light as possible, and use feedback from the users to iterate.
This project was completed as part of the "Python Developer" path at OpenClassrooms.

2. Getting Started
The goal was to improve a web application, through testing and debugging, capable of:

This project uses the following technologies:
- managing lifting competitions
- allowing clubs to authenticate themselves within the application
- allowing clubs to reserve places in several lifting competitions

* Python v3.x+
The application must:

* [Flask](https://flask.palletsprojects.com/en/1.1.x/)
- allow the club secretary to log in.
- allow the club secretary to view competitions and other clubs' points.
- allow the club secretary to use their points to purchase competition tickets.
- display error messages in case of incorrect action, according to the application specifications.

Whereas Django does a lot of things for us out of the box, Flask allows us to add only what we need.

---

* [Virtual environment](https://virtualenv.pypa.io/en/stable/installation.html)
## PROJECT STRUCTURE
<p align="center">
<img src="docs/structure.png" width="auto" style="border: 1px solid grey; border-radius: 10px;">
</p>

This ensures you'll be able to install the correct packages without interfering with Python on your machine.
---

Before you begin, please ensure you have this installed globally.
## INSTALLATION

- ### Clone the repository :

3. Installation
```
git clone https://github.com/Tit-Co/OpenClassrooms_Project_11.git
```

- After cloning, change into the directory and type <code>virtualenv .</code>. This will then set up a a virtual python environment within that directory.
- ### Navigate into the project directory :
`cd OpenClassrooms_Project_11`

- Next, type <code>source bin/activate</code>. You should see that your command prompt has changed to the name of the folder. This means that you can install packages in here without affecting affecting files outside. To deactivate, type <code>deactivate</code>
- ### Create a virtual environment and dependencies :

- Rather than hunting around for the packages you need, you can install in one step. Type <code>pip install -r requirements.txt</code>. This will install all the packages listed in the respective file. If you install a package, make sure others know by updating the requirements.txt file. An easy way to do this is <code>pip freeze > requirements.txt</code>
1. #### With [uv](https://docs.astral.sh/uv/)

- Flask requires that you set an environmental variable to the python file. However you do that, you'll want to set the file to be <code>server.py</code>. Check [here](https://flask.palletsprojects.com/en/1.1.x/quickstart/#a-minimal-application) for more details
`uv` is an environment and dependencies manager.

- #### Install environment and dependencies

`uv sync`

- You should now be ready to test the application. In the directory, type either <code>flask run</code> or <code>python -m flask run</code>. The app should respond with an address you should be able to go to using your browser.
2. #### With pip

4. Current Setup
- #### Install the virtual env :

The app is powered by [JSON files](https://www.tutorialspoint.com/json/json_quick_guide.htm). This is to get around having a DB until we actually need one. The main ones are:

* competitions.json - list of competitions
* clubs.json - list of clubs with relevant information. You can look here to see what email addresses the app will accept for login.
`python -m venv env`

5. Testing
- #### Activate the virtual env :
`source env/bin/activate`
Or
`env\Scripts\activate` on Windows

You are free to use whatever testing framework you like-the main thing is that you can show what tests you are using.
3. #### With [Poetry](https://python-poetry.org/docs/)

We also like to show how well we're testing, so there's a module called
[coverage](https://coverage.readthedocs.io/en/coverage-5.1/) you should add to your project.
`Poetry` is a tool for dependency management and packaging in Python.

- #### Install the virtual env :
`py -3.13 -m venv env`

- #### Activate the virtual env :
`poetry env activate`

- ### Install dependencies
1. #### With [uv](https://docs.astral.sh/uv/)
`uv sync` or `uv pip install -r requirements.txt`

2. #### With pip
`pip install -r requirements.txt`

3. #### With [Poetry](https://python-poetry.org/docs/)
`poetry install`

(NB : Poetry and uv will read the `pyproject.toml` file to know which dependencies to install)

---

## USAGE

### Launching server
- Open a terminal
- Go to project folder - example : `cd gudlft`
- Activate the virtual environment as described previously
- Create flask environment : `$env:FLASK_APP = "server"` (for example in Powershell)
- Launch the Django server : `flask run`

### Launching the APP
- Open a web browser
- And type the URL : `http://127.0.0.1:5000/`

---

## ISSUES THAT HAS BEEN FIXED

- A user types in an email not found in the system
- The club should not be able to redeem more points than available
- The club should be able to book no more than 12 places
- The club should not be able to book a place on a post-dated competition (but past competitions should be visible).
- The amount of points used should be deducted from the club's balance
- The club should be able to see the list of clubs and their associated current points balance
- The club should not be able to book more than the competition places available

---

## EXPLANATIONS OF WHAT THE APP DOES

### <u>Registration</u>
- The user can sign in the application by typing the club name, email and password (two times).

### <u>Authentication</u>
- The user can log in the application by typing the club email and password.

### <u>Profile page</u>
- The user can see the club profile by clicking on "go to profile" link in welcome page.

### <u>Welcome page</u>
- The user can view all past and upcoming competitions, and access the booking page by clicking on the competition they
wish to participate in.

### <u>Booking page</u>
- The user can book places in the competition by typing the number of places. The UI will display a message according
to the validation or rejection of the entry.

### <u>Log out</u>
- The user can log out by clicking the appropriate link.

### <u>Points board</u>
- The user can view the points board with all the clubs and their points.
- No need to be authenticated to see this board.

---

## TEMPLATES EXAMPLES

- Registration
<p align="center">
<img src="docs/screenshots/registration_screenshot.png" width="auto" style="border: 1px solid grey; border-radius: 10px;">
</p>

- Authentication
<p align="center">
<img src="docs/screenshots/authentication_screenshot.png" width="auto" style="border: 1px solid grey; border-radius: 10px;">
</p>

- Profile page
<p align="center">
<img src="docs/screenshots/profile_screenshot.png" width="auto" style="border: 1px solid grey; border-radius: 10px;">
</p>

- Change password
<p align="center">
<img src="docs/screenshots/password_screenshot.png" width="auto" style="border: 1px solid grey; border-radius: 10px;">
</p>

- Points board
<p align="center">
<img src="docs/screenshots/points_board_screenshot.png" width="auto" style="border: 1px solid grey; border-radius: 10px;">
</p>

- Welcome page
<p align="center">
<img src="docs/screenshots/welcome_page_screenshot.png" width="auto" style="border: 1px solid grey; border-radius: 10px;">
</p>

- Booking page
<p align="center">
<img src="docs/screenshots/booking_screenshot.png" width="auto" style="border: 1px solid grey; border-radius: 10px;">
</p>

- Log out
<p align="center">
<img src="docs/screenshots/logout_screenshot.png" width="auto" style="border: 1px solid grey; border-radius: 10px;">
</p>

---
## PEP 8 CONVENTIONS

- Flake 8 report (yet to come)
<p align="center">
<img src="docs/flake8_report.png" width="auto" style="border: 1px solid grey; border-radius: 10px;">
</p>

**Type the line below in the terminal to generate another report with [flake8-html](https://pypi.org/project/flake8-html/) tool :**

` flake8 --format=html --htmldir=flake8-report --max-line-length=119 --extend-exclude=env/`

---

## TESTS COVERAGE WITH PYTEST

Cov report
<p align="center">
<img src="docs/cov_report.png" width="auto" style="border: 1px solid grey; border-radius: 10px;">
<img src="docs/cov_report_2.png" width="auto" style="border: 1px solid grey; border-radius: 10px;">
</p>

- **Type the line below in the terminal to generate another coverage report with pytest**

`pytest --cov=server --cov-report=html:<name-of-report-folder>`

---

## PERFORMANCE TESTS WITH LOCUST

Locust report (yet to come)
<p align="center">
<img src="docs/locust_report.png" width="auto" style="border: 1px solid grey; border-radius: 10px;">
</p>

- **Launch the application as described previously**

- **Open another terminal, activate the virtual env, and type the `locust` command to launch the performance tests**

---

![Python](https://img.shields.io/badge/python-3.13-blue.svg)
![License](https://img.shields.io/badge/license-MIT-green.svg)

---

## AUTHOR
**Name**: Nicolas MARIE
**Track**: Python Developer – OpenClassrooms
**Project 11 – Improve a Flask web app by testing and debugging – March 2025**
92 changes: 76 additions & 16 deletions clubs.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,76 @@
{"clubs":[
{
"name":"Simply Lift",
"email":"john@simplylift.co",
"points":"13"
},
{
"name":"Iron Temple",
"email": "admin@irontemple.com",
"points":"4"
},
{ "name":"She Lifts",
"email": "kate@shelifts.co.uk",
"points":"12"
}
]}
{
"clubs": [
{
"name": "Power Lift",
"email": "admin@powerlift.com",
"password": "scrypt:32768:8:1$c0ePLkJjwFO0xhpP$a9c637393de25e3f6b121ab38d3d9c3589d66879618157ea3382ae9ee2310c28265be341d4af02c4c1d1f81427ccdbc96464b0bb19697a819f5ad987764c17ad",
"points": "5"
},
{
"name": "Titanium Tribe",
"email": "info@titaniumtribe.com",
"password": "scrypt:32768:8:1$4bM8hSwBdKH0Dj2n$d6d64d3a635cc260803451f8b0c9acc1e50bf3a48ab071e9389d9e492cce5131d6c011f841d92b7422bbfdfa6609e198ec529fc3394cb27788a1a696baba767e",
"points": "15"
},
{
"name": "Steel Strength",
"email": "hello@steelstrength.org",
"password": "scrypt:32768:8:1$uGiMzIndzui0kLQp$50ef79e3db9134208a46072a6297637a5636d81ca10b9a42d69883c8a12ee021fdab58df6019339ebc8924312598c4d37a6d71ce8647177241ddf012c69acafc",
"points": "15"
},
{
"name": "Heavy Hitters",
"email": "admin@heavyhitters.net",
"password": "scrypt:32768:8:1$U4IUVIbiypkLsiwd$b57afe44db3af13b7e9772560a228c1100f41c3222b0cbbaa5c8855632fbca004c7d2ca36d7bef52624ee028373a0cd90df65fb9b73d4eb119ad1edf3a741bf9",
"points": "15"
},
{
"name": "Power Lifts Club",
"email": "admin@powerlifts.com",
"password": "scrypt:32768:8:1$zdBGCvw6xXxHzAGl$c4534f2b7b2089aeca6f50bf3221f86f885aa4139692844149becf3c56b37a3c8f6a5f7c47e8c4f60405d591f58cf8f9567d1e383396a5f4de87073d441e5fe3",
"points": "15"
},
{
"name": "Iron Temple",
"email": "admin@irontemple.com",
"password": "scrypt:32768:8:1$rHMWqkkiOSz7QiYU$e1a798fc6d464425359fb999db786ffbe39f6059e195d6d22a15e3ed70be3b5630e1d828399ca241f9d94e109ee5b350067f14a8054079344f01495c73594021",
"points": "4"
},
{
"name": "Olympic Lifters",
"email": "contact@olympiclifters.com",
"password": "scrypt:32768:8:1$CO1XjG2GYak7bGad$906886f7afc2f66ac120f12b263e195fd44283a3cf0a39f963722ca25fc62e0909629165ff184ab67e43dfb44b4ca87ec7448ce95bcd896af2d2c32a31ffa604",
"points": "15"
},
{
"name": "Barbell Warriors",
"email": "info@barbellwarriors.com",
"password": "scrypt:32768:8:1$ZmtTQFYQVRwhl8cK$d4abb1c57ba950bb082a6c963605af00a0e120f7b6d7346d2a9419efad6d7d5a78c7d15a32b57d4fc2eab10aa864977be0a3734c24f69bc6694cd9b224b57545",
"points": "15"
},
{
"name": "Simply Lift",
"email": "john@simplylift.co",
"password": "scrypt:32768:8:1$cYYbKbko75gPN3N3$4883a2360abf24fcc9f8329aedfca168994222748933eff4d89c78e5764f0972fce4c478b5737ece1bd31a3d2a0f1a00586096ffbddb79809b9685eabc5e5f4e",
"points": "13"
},
{
"name": "She Lifts",
"email": "kate@shelifts.co.uk",
"password": "scrypt:32768:8:1$E4fcXT3MQ7oVfc0w$cf31c4a6aec02d4532ffcae03670b12f20265036a3ae5ee941fae6d135ca2db5e406fe9e6c6eded7776e0c256f6d8970f2cbfb74ee50a1c7f9b49b1ad6819b40",
"points": "12"
},
{
"name": "Iron Titans",
"email": "contact@irontitans.com",
"password": "scrypt:32768:8:1$kRW7krsT6zGr4iLk$6a24553114aa57f8cf4297786bf6136fa1d6f5f9832c6157fb406eb4459fcde2a82ed2a64d890ebe5e9a6efe73376239c59a124c77b6bd79b371c84095496b78",
"points": "15"
},
{
"name": "The Weightroom",
"email": "team@weightroom.com",
"password": "scrypt:32768:8:1$38I8jEaWVYS5jgcA$0b29c9aa0e7f52b2634516d46b312ba429d2748fd4d72973f83275d4ada39907a6bae0389d31a868acdd4b5b43363515186f86e5f7419f9253d092c94d2a9185",
"points": "15"
}
]
}
Loading