supercontest.core.picks

Logic to handle all user picks.

Functions

commit_picks

Wrapper to write picks to the database.

email_all_picks

Helper function to get the screenshot of the all-picks table and email it to the users that want it.

email_unfinished_pickers

Helper function to query the db and find the people who have not submitted all 5 picks for the week, then email them a reminder.

screenshot_picks_table

Grabs a screenshot of the all-picks table, to be emailed to users.

supercontest.core.picks.commit_picks(user_id: int, season: int, week: int, teams: list[str], emails: list[str] | None = None, verify: bool = True) None

Wrapper to write picks to the database.

Parameters:
  • user_id – The ID of the user submitting picks.

  • season – The season to pick for.

  • week – The week to pick for.

  • teams – The picks from the client.

  • emails – The email addresses to send confirmation to.

  • verify – Whether or not to check conditions like max5, which weekday, etc.

Raises:

InvalidPicks – If verifications fail.

supercontest.core.picks.email_all_picks() bool

Helper function to get the screenshot of the all-picks table and email it to the users that want it. This function handles the subscription check.

Returns:

Whether or not the email was sent.

supercontest.core.picks.email_unfinished_pickers() bool

Helper function to query the db and find the people who have not submitted all 5 picks for the week, then email them a reminder.

Returns:

Whether or not the email was sent.

supercontest.core.picks.screenshot_picks_table(driver: Any, season: int | None = None, week: int | None = None) tuple[int, int, str]

Grabs a screenshot of the all-picks table, to be emailed to users. Does not filter the table by Paid league. Grabs the whole Free league for the current season/week. Always pulls from the production app (domain).

This function assumes you’re in an active regular season week. The check is completed by the caller, not this function.

Parameters:
  • driver – The chrome webdriver, always passed by the decorator.

  • season – Exposed for testing, if you want to screenshot a picks table outside of the current season+week. You must pass both season+week to trigger this.

  • week – Exposed for testing, if you want to screenshot a picks table outside of the current season+week. You must pass both season+week to trigger this.

Returns:

Season year, if in an active season.

Returns:

Week number, if in an active week.

Returns:

Relative path to the output .png file.

Raises:

ValueError – If not in a current season+week, and not passed a season+week instead.