From 2dc85f19e79e9e4ccbc2a5fb8413a5bd4f064de3 Mon Sep 17 00:00:00 2001 From: yann Date: Thu, 26 Jun 2025 15:08:51 +0200 Subject: [PATCH 1/2] added public list of club`s points --- server.py | 4 +++- templates/index.html | 1 + templates/points.html | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 templates/points.html diff --git a/server.py b/server.py index 45dc6be..1288483 100644 --- a/server.py +++ b/server.py @@ -80,7 +80,9 @@ def purchasePlaces(): competitions=competitions, now=now) # TODO: Add route for points display - +@app.route('/points') +def displayPoints(): + return render_template('points.html', clubs=clubs) @app.route('/logout') def logout(): diff --git a/templates/index.html b/templates/index.html index 5bd9351..1340581 100644 --- a/templates/index.html +++ b/templates/index.html @@ -22,5 +22,6 @@ + Board of points diff --git a/templates/points.html b/templates/points.html new file mode 100644 index 0000000..b5c9def --- /dev/null +++ b/templates/points.html @@ -0,0 +1,18 @@ + + + + + Board of clubs and points || GUDLFT + + +

Current points

+ + Back + + \ No newline at end of file -- 2.39.5 From 9e3e0495350f31a317383446df2c163d217581ae Mon Sep 17 00:00:00 2001 From: yann Date: Wed, 9 Jul 2025 12:30:10 +0200 Subject: [PATCH 2/2] template fixed, 2 tests on display --- templates/points.html | 5 +++-- tests/test_board.py | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 tests/test_board.py diff --git a/templates/points.html b/templates/points.html index b5c9def..abc6e53 100644 --- a/templates/points.html +++ b/templates/points.html @@ -10,9 +10,10 @@ {% for club in clubs %}
  • club : {{club['name']}}
    Points : {{club['points']}}
    -
    +
    +
  • {% endfor %} Back - \ No newline at end of file + diff --git a/tests/test_board.py b/tests/test_board.py new file mode 100644 index 0000000..6fbb33e --- /dev/null +++ b/tests/test_board.py @@ -0,0 +1,24 @@ +from bs4 import BeautifulSoup +from server import loadClubs + + +class TestBoardDisplayPoints: + + def test_should_get_200(self, client): + ''' + test if the page is retrieved + ''' + response = client.get('/points') + assert response.status_code == 200 + + def test_should_display_right_size_list(self, client): + ''' + test if the list of club displayed and in DB have the same size + ''' + list_club = loadClubs() + response = client.get('/points') + soup = BeautifulSoup(response.data, "html.parser") + li = soup.find_all("li") + assert len(li) == len(list_club) + + -- 2.39.5