This website was created for creating fantasy disc golf leagues.
- Technologies Used
- Features
- How to Set Up Locally
- How to Deploy Locally
- How to Deploy on Heroku
- Basic Usage
- Troubleshooting
- Features To Add
- Credits
- Ruby
- Rails
- React
- Typescript
- User Authentication
- 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
- Ensure all required gems are installed:
- Start the Rails Server:
- Run the server:
rails s
- Run the server:
- 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
- Open Rails console:
- Check if the Database Exists:
- 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
- Run:
- Restart the server
- Run:
rails s
- Run:
- Open a terminal in the project directory
- Run:
.\update-app.bat "Your commit message here"
- Activate the virtual env:
- Navigate to the python folder in the terminal
- Run
.\venv\Scripts\activate
- User: mic@mic.com | Password: pass123
- User: tom@tom.com | Password: pass123
- Start the Rails Console:
- Development:
rails console
- Production:
heroku run rails console -a dg-draft
- Development:
- 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')
- 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
- Development:
- 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;
- View all data from table:
- 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
- Apply migrations after modifying the models
- 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
Michelle Flandin