Giter VIP home page Giter VIP logo

bigleague's Introduction

bigleague

Web app that takes Sleeper leagues and turns them into a big league.

The end goal is to be able to run a league of 80+ players using Sleeper as the platform.

Setup

Setting up bigleague should be quite simple. There are two required pieces, a Postgres instance and the bigleague server.

Postgres Quickstart

A simple way to get started is with Postgres in a container. We'll be using podman, and installation instructions can be found here. It can be found in most modern package managers for easy install.

Start by pulling the official Postgres image from Docker:

podman pull docker.io/library/postgres:14

Launch a pod for Postgres to be placed in:

podman pod create --name postgres -p 5432:5432

Add a Postgres instance to the pod:

podman run -dt --pod postgres -e POSTGRES_DB=bigleague -e POSTGRES_USER=admin -e POSTGRES_PASSWORD=password postgres:14

This will expose Postgres under the default port 5432 for testing and development.

Starting bigleague

Make sure that the Bigleague.toml configuration file points to your Postgres database:

...
user = "admin"
password = "password"
dbname = "bigleague"
...

Also, be sure to add a list of participating leagues (in the form of Sleeper league ids) under the .bigleague.leagues field.

Then we can start bigleague with cargo:

RUST_LOG=info cargo run

The RUST_LOG env variable sets the log level.

bigleague's People

Contributors

drewrip avatar

Watchers

 avatar

bigleague's Issues

rework database interface

Bigleague has a module, db, for common functionality and interactions with the Postgres database. This is becoming difficult to maintain and difficult to abstract just using tokio_postgres. Before introducing too much more complex behavior, this should really be rewritten to be more generic and safe, or use something like Diesel. My current plan is to implement Diesel.

matchups: show the current matchups for a user and their scores

The Sleeper API allows to grab a user's matchup for a given week with the endpoint:

GET https://api.sleeper.app/v1/league/<league_id>/matchups/<week>

Their documentation on this endpoint can be found here.

It would be nice to show a users future matchups and what the scores for their players.

add bracket to standings

The "playoffs" in our bigleague will be some kind of configurable bracket. We want to display a bracket based on the projected top finishers in the league.

This will require knowledge of the NFL state, specifically which week in the league it is.

make common settings configurable via config file

There are many basic settings that should be easily accessible and configurable. For instance, the address and port of the database, credentials for the database, max numbers of connections to the database, and details about the size of the bracket.

We need to decide on the format of the config file, and take out the hard coded values that are currently used.

add NFL season state to DB

In order to display the current week on the standings page, and correctly track the bracket in the future we need to know the state of the NFL season. This means we need to add a table to the DB and ensure we update the state regularly.

See the Sleeper docs for information about this query: https://docs.sleeper.com/#get-nfl-state

$ curl "https://api.sleeper.app/v1/state/nfl"
{
  "week": 2, // week
  "season_type": "regular", // pre, post, regular
  "season_start_date": "2020-09-10", // regular season start
  "season": "2020", // current season
  "previous_season": "2019",
  "leg": 2, // week of regular season
  "league_season": "2021", // active season for leagues
  "league_create_season": "2021", // flips in December
  "display_week": 3 // Which week to display in UI, can be different than week
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.