supercontest.views.main

The main blueprint is the collection of all other (non-contest) views, the ones that don’t require a season or week to be specified.

Module Attributes

main_blueprint

The toplevel blueprint for everything that's not a contest view.

Functions

add_to_paid_league

Allows an admin to add a user to the current season's paid league.

alltimelb

Shows all league all user all season scores.

change_status

Allows an admin to change the status of a game.

checkout

Route handles stripe payment.

checkout_confirmation

When stripe sees a completed purchase, it sends a webhook event here.

checkout_success

If a stripe checkout was successful.

commit_lines

The route which handles the line commit every wednesday evening.

commit_lines_manual

The route which handles manual line entry by admins.

contact

Contact form for user communication.

email_preferences

Form in which users can change their notifications.

feedback

A cheeky input form for user feedback.

get_games

Fetched the sorted games, just like matchups/allpicks page load, but intended to be called async to update scores.

home

The home route of the application.

pick

This route handles picks from the client.

pick_late

Allows an admin to submit picks late for a user.

send_email_picks_open

Sends picks open email to all subscribed users.

supercontest.views.main.add_to_paid_league() Response

Allows an admin to add a user to the current season’s paid league.

Returns:

JSON response with success status and message.

supercontest.views.main.alltimelb() str

Shows all league all user all season scores.

Returns:

The rendered template for the route.

supercontest.views.main.change_status() Response

Allows an admin to change the status of a game. This is useful when the scorestrip is not realtime/live.

Returns:

A redirect to the matchups view.

supercontest.views.main.checkout() str | Response

Route handles stripe payment.

Returns:

The rendered template for the checkout route with a loaded session, or a redirect home (if it’s the offseason or the user is already in the paid league).

supercontest.views.main.checkout_confirmation() Response

When stripe sees a completed purchase, it sends a webhook event here. If it receives 200 from this route, then it will forward the user to the success_url.

Returns:

The flask response.

supercontest.views.main.checkout_success() str

If a stripe checkout was successful.

Returns:

The rendered template for the route.

supercontest.views.main.commit_lines() Response

The route which handles the line commit every wednesday evening.

Returns:

A redirect to the matchups view.

supercontest.views.main.commit_lines_manual() Response

The route which handles manual line entry by admins.

Returns:

A redirect to the matchups view.

supercontest.views.main.contact() str

Contact form for user communication.

Returns:

The rendered template for the route.

supercontest.views.main.email_preferences() str | Response

Form in which users can change their notifications.

Returns:

The rendered template for the route (if GET) or a redirect home (if POST).

supercontest.views.main.feedback() str

A cheeky input form for user feedback.

Returns:

The rendered template for the route.

supercontest.views.main.get_games(season: str, week: str) list[Game]

Fetched the sorted games, just like matchups/allpicks page load, but intended to be called async to update scores. This just runs the query. The frontend stitches the data into the view.

Parameters:
  • season – Season year to fetch games for.

  • week – Week within season to fetch games for.

Returns:

List of sorted games (DB objects) for that week, serialized by that model’s schema.

supercontest.views.main.home() Response

The home route of the application.

Returns:

A redirect to the desired (actual) landing page of the app.

supercontest.views.main.main_blueprint = <Blueprint 'main'>

The toplevel blueprint for everything that’s not a contest view.

supercontest.views.main.pick() Response

This route handles picks from the client.

Returns:

A flask response.

supercontest.views.main.pick_late() Response

Allows an admin to submit picks late for a user.

Returns:

A redirect to the allpicks view.

Raises:

ValueError – If not in a current week in the regular season.

supercontest.views.main.send_email_picks_open() str

Sends picks open email to all subscribed users. :return: Success or failure message.