Class: Lineup

Lineup()

Model representing a starting lineup/bench configuration for a given team. These will have copies frozen for each week that progresses.

Constructor

new Lineup()

Source:

Extends

  • Model

Methods

(async, static) get_and_update_for_team(team) → {Promise.<Lineup>}

Given a team, fetch the latest draft lineup for that team. This will also update the lineup record so that it includes all players currently on the team (benching any players not already in the lineup). If no lineup exists, one will be created.
Parameters:
Name Type Description
team Team
Source:
Returns:
Type
Promise.<Lineup>

bench_player(player)

Removes the player from the starting lineup if they are there and adds them to the bench if they aren't already there.
Parameters:
Name Type Description
player Player
Source:

(async) calculate_fantasy_points() → {Promise.<number>}

Calculate the fantasy points scored by the starting players on this lineup.
Source:
Returns:
Type
Promise.<number>

clear_lineup()

Remove all players from the bench and the starting lineup.
Source:

has_bench_player(player) → {boolean}

Returns true if the given player is on the bench in this lineup.
Parameters:
Name Type Description
player Player
Source:
Returns:
Type
boolean

has_player(player) → {boolean}

Returns true if the given player is in this lineup anywhere.
Parameters:
Name Type Description
player Player
Source:
Returns:
Type
boolean

has_starting_player(player) → {boolean}

Returns true if the given player is on the starting lineup in this lineup.
Parameters:
Name Type Description
player Player
Source:
Returns:
Type
boolean

(async) players_in_starting() → {Promise.<Array.<Model>>}

Returns an array of Players that are on the starting lineup.
Source:
Returns:
Type
Promise.<Array.<Model>>

(async) players_on_bench() → {Promise.<Array.<Model>>}

Returns an array of Players that are on the bench for this lineup.
Source:
Returns:
Type
Promise.<Array.<Model>>

start_player(player_position_record)

Given the player_id/position record, add it to the starting lineup.
Parameters:
Name Type Description
player_position_record object
Source:

(async) to_api() → {Promise.<object>}

Cast the lineup to an object which can be returned via the API.
Source:
Returns:
Type
Promise.<object>