Skip to content

arbilgin/tahminc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Plan: Football Match Prediction App (Final) A football prediction PWA for World Cup 2026. Flask + PostgreSQL backend with Flask-Admin for match management, Ionic/Angular PWA frontend with Google sign-in via Firebase. Users predict scores in groups, earn points with dynamic underdog bonuses (<1/5 of group).

Steps Initialize Flask backend — Create backend/ with app factory, configure PostgreSQL (SQLAlchemy + Flask-Migrate), set up Flask-CORS, install firebase-admin for token verification, and add Flask-Admin for match result entry.

Create database models — 7 models: User, Group, GroupMember, Tournament (seed with World Cup 2026), Match (home/away team, round, multiplier), Prediction, Points. Add Flask-Admin views for Tournament and Match models.

Build points calculation service — Scoring logic: +3 result, +1 home goals, +1 away goals, +1 goal diff, +1 underdog result (if < group_size/5 correct), +1 underdog score (if < group_size/5 exact). Multiply by round (1-5). Trigger recalculation when admin enters match result.

Implement Flask REST API — POST /auth/google (verify Firebase token, upsert user), groups CRUD + join by code, matches list (filter by upcoming/finished), predictions CRUD (lock at kickoff), leaderboards (global + group).

Create Ionic/Angular PWA — ionic start tahmin --type=angular, add @angular/pwa, integrate AngularFire with Google auth provider. Pages: Login, Matches (upcoming/results), Predict, Groups (create/join), Leaderboard.

Deploy — Frontend on Firebase Hosting, backend on Railway/Render with PostgreSQL. Configure Firebase project with Google sign-in enabled.

Project Structure /home/arda/Desktop/enformatik/tahminc/ ├── backend/ │ ├── app/ │ │ ├── init.py # create_app factory │ │ ├── config.py # DB URI, Firebase config │ │ ├── extensions.py # db, migrate, admin │ │ ├── models/ # User, Group, Match, etc. │ │ ├── api/ # Blueprints: auth, matches, predictions │ │ ├── services/ │ │ │ └── points_calculator.py │ │ └── admin/ # Flask-Admin views │ ├── migrations/ │ ├── requirements.txt │ └── run.py ├── frontend/ # Ionic/Angular PWA │ ├── src/app/ │ │ ├── pages/ # login, matches, predict, groups, leaderboard │ │ ├── services/ # auth, api, prediction │ │ └── guards/ # auth guard │ ├── angular.json │ └── package.json └── README.md

Flask-Admin Setup

admin/init.py - Simple admin for match results

from flask_admin import Admin from flask_admin.contrib.sqla import ModelView

class MatchAdmin(ModelView): column_list = ['home_team', 'away_team', 'match_date', 'round', 'home_score', 'away_score', 'is_finished'] form_columns = ['tournament', 'home_team', 'away_team', 'match_date', 'round', 'home_score', 'away_score', 'is_finished']

def on_model_change(self, form, model, is_created):
    if model.is_finished and model.home_score is not None:
        # Trigger point calculation for all predictions
        calculate_points_for_match(model.id)

admin = Admin(name='World Cup 2026 Admin', template_mode='bootstrap4') admin.add_view(MatchAdmin(Match, db.session)) admin.add_view(ModelView(Tournament, db.session))

Timeline Estimate Phase Tasks Time

  1. Backend setup Flask, PostgreSQL, models, migrations 1 day
  2. Flask-Admin Match/Tournament admin views 0.5 day
  3. API endpoints Auth, matches, predictions, leaderboards 2 days
  4. Points service Calculation + underdog logic 0.5 day
  5. Ionic PWA setup Project, Firebase, routing 1 day
  6. PWA pages Login, matches, predict, groups, leaderboard 2-3 days
  7. Integration & deploy Connect frontend/backend, deploy 1 day Total 8-9 days

Plan: Tahminc — Football Prediction App (Final) A football prediction PWA for World Cup 2026. Flask + PostgreSQL backend with Flask-Admin, Ionic/Angular PWA with Google sign-in. 4-day intensive build.

Steps Day 1 AM: Flask backend + database — Initialize /home/arda/Desktop/enformatik/tahminc/backend/, configure PostgreSQL + SQLAlchemy, create all 7 models (User, Group, GroupMember, Tournament, Match, Prediction, Points), run migrations, seed World Cup 2026 tournament.

Day 1 PM: Flask-Admin + Points service — Add Flask-Admin for Match and Tournament management, implement PointsCalculator with underdog bonus (<1/5 rule), wire point calculation to trigger when admin marks match as finished.

Day 2: Complete REST API — Build all endpoints: POST /auth/google, groups (create/join/leave/list), matches (upcoming/finished), predictions (create/update before kickoff), leaderboards (global + group). Add Firebase token verification middleware.

Day 3: Ionic PWA frontend — ionic start tahminc --type=angular, enable PWA, configure Firebase + Google auth, create 5 pages: Login, Matches, Predict, Groups, Leaderboard. Build API service to connect to Flask backend.

Day 4: Integration + Deploy — Connect frontend to backend, test full flow (login → predict → view points), deploy backend to Railway, frontend to Firebase Hosting, final testing.

Project Structure

/home/arda/Desktop/enformatik/tahminc/ ├── backend/ │ ├── app/ │ │ ├── init.py │ │ ├── config.py │ │ ├── extensions.py │ │ ├── models/ │ │ ├── api/ │ │ ├── services/ │ │ └── admin/ │ ├── migrations/ │ ├── requirements.txt │ └── run.py ├── frontend/ │ ├── src/app/ │ │ ├── pages/ │ │ ├── services/ │ │ └── guards/ │ └── ... └── README.md

4-Day Intensive Schedule Day Morning (4-5h) Afternoon (4-5h) 1 Flask setup, PostgreSQL, all models, migrations Flask-Admin, points calculator, seed data 2 Auth API, matches API, predictions API Groups API, leaderboards API, testing 3 Ionic setup, Firebase auth, Login page Matches + Predict pages 4 Groups + Leaderboard pages Deploy, integration testing MVP Scope (4 days) Included:

Google sign-in View World Cup 2026 matches Submit/edit predictions before kickoff Create/join groups with code Global + group leaderboards Admin panel for match results Points with underdog bonus Deferred:

Push notifications Match reminders User avatars/profiles Multiple tournaments Prediction statistics/analytics

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors