gcp-hockey-results/motm_app
2025-09-29 10:43:48 +08:00
..
static Separate MotM app out 2025-09-29 10:43:48 +08:00
templates Separate MotM app out 2025-09-29 10:43:48 +08:00
app.py Separate MotM app out 2025-09-29 10:43:48 +08:00
app.yaml Separate MotM app out 2025-09-29 10:43:48 +08:00
db_config.py Separate MotM app out 2025-09-29 10:43:48 +08:00
deploy.py Separate MotM app out 2025-09-29 10:43:48 +08:00
forms.py Separate MotM app out 2025-09-29 10:43:48 +08:00
main.py Separate MotM app out 2025-09-29 10:43:48 +08:00
README.md Separate MotM app out 2025-09-29 10:43:48 +08:00
readSettings.py Separate MotM app out 2025-09-29 10:43:48 +08:00
requirements.txt Separate MotM app out 2025-09-29 10:43:48 +08:00
tables.py Separate MotM app out 2025-09-29 10:43:48 +08:00
test_app.py Separate MotM app out 2025-09-29 10:43:48 +08:00

HKFC Men's D Team - MOTM (Man of the Match) System

This is a standalone Flask application for managing Man of the Match and Dick of the Day voting for the HKFC Men's D Team hockey club.

Features

Public Section

  • Voting Interface: Players can vote for MOTM and DotD via secure random URLs
  • Match Comments: View and add comments from matches
  • Current Holders: Display current MOTM and DotD holders

Admin Section

  • Match Management: Set up upcoming matches, opposition teams, and fixtures
  • Squad Management: Add/remove players from match squads
  • Statistics: Record goals and assists for players
  • Voting Results: View real-time voting charts and results
  • Player of the Year: Track season-long MOTM/DotD statistics

Installation

  1. Install dependencies:
pip install -r requirements.txt
  1. Configure database settings in db_config.py

  2. Run the application:

python main.py

The application will be available at http://localhost:5000

Database Requirements

The application requires access to the following database tables:

  • _hkfcD_matchSquad - Current match squad
  • _HKFC_players - Player database
  • hkfcDAdminSettings - Admin configuration
  • hockeyFixtures - Match fixtures
  • _hkfc_d_motm - MOTM/DotD voting results
  • _motmComments - Match comments
  • _clubTeams - Club and team information
  • mensHockeyClubs - Club logos and information

API Endpoints

Public Endpoints

  • / - Main index page
  • /motm/<randomUrlSuffix> - Voting page (requires valid URL suffix)
  • /motm/comments - Match comments
  • /motm/vote-thanks - Vote submission processing

Admin Endpoints (Basic Auth Required)

  • /admin/motm - MOTM administration
  • /admin/squad - Squad management
  • /admin/squad/submit - Process squad selection
  • /admin/squad/list - View current squad
  • /admin/squad/remove - Remove player from squad
  • /admin/squad/reset - Reset squad for new match
  • /admin/stats - Goals and assists administration
  • /admin/voting - Voting results charts
  • /admin/poty - Player of the Year charts

API Endpoints

  • /api/vote-results - Get voting results as JSON
  • /api/poty-results - Get Player of the Year results as JSON
  • /admin/api/team/<club> - Get teams for a club
  • /admin/api/logo/<club> - Get club logo URL
  • /admin/api/fixture/<fixture> - Get fixture information

Security

  • Admin sections are protected with HTTP Basic Authentication
  • Voting URLs use random suffixes to prevent unauthorized access
  • All admin actions require authentication

Usage

  1. Admin Setup:

    • Access /admin/motm to configure upcoming matches
    • Use /admin/squad to select players for the match
    • Activate voting to generate the public voting URL
  2. Player Voting:

    • Share the generated voting URL with players
    • Players can vote for MOTM and DotD
    • Optional comments can be added
  3. Results:

    • View real-time results at /admin/voting
    • Track season statistics at /admin/poty

Configuration

Update the following in db_config.py:

  • Database connection details
  • Cloud SQL configuration (if using Google Cloud)
  • Local database settings

The application uses the same database as the main hockey results system, so ensure proper database access is configured.