Skip to content

This website is designed for creating fantasy disc golf leagues, where users can challenge each other to disc golf event fantasy player challenges.

Notifications You must be signed in to change notification settings

michellevit/DG-Draft

Repository files navigation

DG Draft

Ruby Version Rails Version React Version TypeScript PostgreSQL Heroku

This website was created for creating fantasy disc golf leagues.

Table of Contents

Technologies Used

  • Ruby
  • Rails
  • React
  • Typescript

Features

  • User Authentication

How to Set Up Locally

  • Preliminary checks
    • Check if the Database Exists:
      • Open the project folder in a terminal
      • Run:
        psql -U postgres -h localhost -c "\l"
      • Enter the database password (found in the .env file).
      • Verify that the database name (DB_NAME from .env) is listed.
      • If the database does not exist, create and migrate it:
        rails db:create
        rails db:migrate
    • Install Dependencies:
      • Ensure all required gems are installed:
        bundle install
    • Start the Rails Server:
      • Run the server:
        rails s
    • Verify Database Data:
      • Open Rails console:
        rails console
      • List tables to verify schema:
        ActiveRecord::Base.connection.tables
      • Check if tables contain data:
        players = Player.limit(10)
        players.each { |player| puts player.inspect }
        exit
      • If the database is empty, seed it:
        rails db:seed

How to Deploy Locally

  • Start the Rails Server:
    • Open a terminal in the project directory
    • Run: rails s
  • Access the Application:
    • Open your web browser.
    • Go to http://localhost:3000
  • Push changes locally:
    • Open a terminal in the project directory
    • Rebuild the reactapp and replace the old build in the public folder:
      • Run: .\update-local
    • Restart the server
      • Run: rails s

How to Deploy on Heroku

  • Open a terminal in the project directory
  • Run: .\update-app.bat "Your commit message here"

Basic Usage

Activate the Virtual Env

  • Activate the virtual env:
    • Navigate to the python folder in the terminal
    • Run .\venv\Scripts\activate

Test Data

Common PostgreSQL Queries

  • Start the Rails Console:
    • Development: rails console
    • Production: heroku run rails console -a dg-draft
  • List all User data: User.all
  • Change a User password:
    • user = User.find_by(email: 'user@example.com')
    • user.password = 'new_password'
    • user.save
    • Verify: user.authenticate('new_password')

Update Player/Event Data

  • Make a copy of the python/dg-data-2024.xlsx file and update the year
  • Get the data from pdga.com (follow notes instructions)
    • Copy/paste the player and event data
  • Save the file in the python folder
  • Modify the jsonify-data.py var 'excel_file_name' to have the current year
  • Run python jsonify.data.py
  • The data will be saved to the json files in lib/seeds
  • Run the rake file to push the data to the database
    • Development: rails db:seed
    • Production: heroku run rake db:seed --app dg-draft
    • Note: this will not create duplicates of entries with the same pdga#
    • Note: this will not create duplicates of events with the same start/end date

Using the Heroku CLI

  • Login: heroku login
  • Migrate DB: heroku run rake db:migrate -a dg-draft
    • Note: make sure to commit to git before migrating
  • Open DB Console: heroku pg:psql -a dg-draft
    • View all data from table: SELECT * FROM users;
    • Delete all data from table: DELETE FROM challenges;
  • Get DB Data?: heroku run rails console -a dg-draft
  • Get Heroku Logs: heroku logs -a dg-draft
  • Restart Heroku Server: heroku restart -a dg-draft
  • Seed DB: heroku run rake db:seed --app dg-draft

Troubleshooting

  • Apply migrations after modifying the models

Features To Add

  • add bet-card component
    • tournament name
    • MPO or FPO
    • tournament date start
    • tournament date end
    • close-window for selecting players
    • single or matchup
    • player A
    • player B
    • player C
    • player D
    • player E
  • add leaderboard
  • forgot password
  • change password
  • contact form

Credits

Michelle Flandin

About

This website is designed for creating fantasy disc golf leagues, where users can challenge each other to disc golf event fantasy player challenges.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published