Skip to content

Conversation

@elof-dev
Copy link

Summary

This pull request fixes **Issue #5 ** - clubs should not be allowed to book in past competitions

Context

The function book() allowed booking for past competitions
They should not be able to book a place on a post-dated competition (but past competitions should be visible)

Changes Made

  • server.py → added a date validation in the book() route:
    if the competition date is in the past, a flash message is displayed and the user stays on the same page
  • tests/test_book_past_competition.py → create to test book() behaviour

Testing

  • 2 tests created and passed successfully with pytest
  • Verified status code and message in the browser for :
    • booking future competition
    • booking past competition

Linked Issue

Fix #5

- Updated showSummary() in server.py to handle email validation and error messages
- Modified index.html to display flash messages correctly
- Created tests/ folder with conftest.py and test_show_summary.py for unit testing
- Added .flaskenv for local environment configuration
- Updated .gitignore to include .venv and exclude tests/ folder
- Updated requirements.txt to add pytest dependency
- Updated purchasePlaces() to check if the club has enough points before confirming a booking
- Added a new test file with 2 unit tests to verify point validation logic
- Updated purchasePlaces() to check avoid clubs booking more than 12 places per competition
- Added a new test file with 2 unit tests to verify point validation logic
- Updated book() to avoid clubs booking in past competition
- Added a new test file with 2 unit tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Booking places in past competitions

1 participant