View standings for a league.
 @see https://statsapi.mlb.com/docs/#operation/standings
338772
def standings(options = {})
      options[:hydrate] = 'team' unless options.key?(:hydrate)

      if options[:leagues] && !options[:leagueId]
        league_ids = Leagues::LEAGUES.values_at(*options.delete(:leagues))

        options[:leagueId] = league_ids
      end

      options[:leagueId] = [103, 104] unless Array(options[:leagueId])&.any?

      get '/standings', options
    end
1239214
def get_projected_player_game_stats_by_team(self, season, week, team_id):
        
        result = self._method_call("PlayerGameProjectionStatsByTeam/{season}/{week}/{team_id}", "projections", season=season, week=week, team_id=team_id)
        return result
787362
function($root) {
			var match 	= this.model.get('data');

			this.updateScore(match.teamAScore, $root.find('.team.left .team-score'));
			this.updateScore(match.teamBScore, $root.find('.team.right .team-score'));
		}
1108572
public function majRankMedal()
    {
        $players = $this->findBy(array(), array('chartRank0' => 'DESC', 'chartRank1' => 'DESC', 'chartRank2' => 'DESC', 'chartRank3' => 'DESC'));

        Ranking::addObjectRank($players, 'rankMedal', array('chartRank0', 'chartRank1', 'chartRank2', 'chartRank3'));
        $this->getEntityManager()->flush();
    }
215157
def league_scores(self, total_data, time, show_datetime,
                      use_12_hour_format):
        """"""
        for match in total_data['matches']:
            self.scores(self.parse_result(match), add_new_line=not show_datetime)
            if show_datetime:
                click.secho('   %s' % Stdout.utc_to_local(match["utcDate"],
                                                          use_12_hour_format,
                                                          show_datetime),
                            fg=self.colors.TIME)
            click.echo()
37120
public static function getlastDays($nb = 5, League $league = null, $include_archived = false) {
    $day_storage = \Drupal::entityTypeManager()->getStorage('day');
    $injected_database = Database::getConnection();
    $now = new \DateTime(null, new \DateTimeZone("UTC"));

    $query = $injected_database->select('mespronos__game', 'g');
    $query->addExpression('min(game_date)', 'day_date');
    $query->addExpression('count(g.id)', 'nb_game_over');
    $query->groupBy('day');
    $query->fields('g', array('day'));
    $query->join('mespronos__day', 'd', 'd.id = g.day');
    if ($league) {
      $query->condition('d.league', $league->id());
    }
    else {
      $query->join('mespronos__league', 'l', 'l.id = d.league');
      if (!$include_archived) {
        $query->condition('l.status', 'active');
      }
    }
    $query->condition('game_date', $now->format('Y-m-d\TH:i:s'), '<');
    $query->orderBy('day_date', 'DESC');
    $query->range(0, $nb);
    $results = $query->execute();
    $results = $results->fetchAllAssoc('day');
    $days = $day_storage->loadMultiple(array_keys($results));

    foreach ($results as $key => &$day_data) {
      $day_data->nb_game = $days[$key]->getNbGame();
      $day_data->nb_game_with_score = $days[$key]->getNbGameWIthScore();
      $day_data->entity = $days[$key];
    }
    return $results;
  }
362032
def team_scores(self, team_scores, time):
        """"""
        headers = ['Date', 'Home Team Name', 'Home Team Goals',
                   'Away Team Goals', 'Away Team Name']
        result = [headers]
        result.extend([score["utcDate"].split('T')[0],
                       score['homeTeam']['name'],
                       score['score']['fullTime']['homeTeam'],
                       score['score']['fullTime']['awayTeam'],
                       score['awayTeam']['name']]
                      for score in team_scores['matches']
                      if score['status'] == 'FINISHED')
        self.generate_output(result)
723592
def load_from_id(gid)
      @gid = gid
      @xml_data = GamedayFetcher.fetch_boxscore(gid)
      @xml_doc = REXML::Document.new(@xml_data)
      if @xml_doc.root
        @game = Game.new(@gid)
        @game.boxscore = self
        set_basic_info
        @linescore = LineScore.new
        @linescore.init(@xml_doc.root.elements["linescore"])
        @home_runs = @linescore.home_team_runs
        @away_runs = @linescore.away_team_runs
        @game_info = @xml_doc.root.elements["game_info"].text
  	    set_batting_text
        set_cities
        set_pitchers
        set_batters
        set_weather
      end
    end
285775
def get_team_scores(self, team, time, show_upcoming, use_12_hour_format):
        """"""
        team_id = self.team_names.get(team, None)
        time_frame = 'n' if show_upcoming else 'p'
        if team_id:
            try:
                req = self._get('teams/{team_id}/matches?timeFrame={time_frame}{time}'.format(
                            team_id=team_id, time_frame=time_frame, time=time))
                team_scores = req.json()
                if len(team_scores["matches"]) == 0:
                    click.secho("No action during past week. Change the time "
                                "parameter to get more fixtures.", fg="red", bold=True)
                else:
                    self.writer.team_scores(team_scores, time, show_upcoming, use_12_hour_format)
            except APIErrorException as e:
                click.secho(e.args[0],
                            fg="red", bold=True)
        else:
            click.secho("Team code is not correct.",
                        fg="red", bold=True)
228286
def get_projected_player_game_stats_by_player(self, season, week, player_id):
        
        result = self._method_call("PlayerGameProjectionStatsByPlayerID/{season}/{week}/{player_id}", "projections", season=season, week=week, player_id=player_id)
        return result
1208251
def standings(self):
        ''''''
        headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain","User-Agent": user_agent}
        req = self.session.get('http://'+self.domain+'/standings.phtml',headers=headers).content
        soup = BeautifulSoup(req)
        table = soup.find('table',{'id':'tablestandings'}).find_all('tr')
        clasificacion = []
        [clasificacion.append(('%s\t%s\t%s\t%s\t%s')%(tablas.find('td').text,tablas.find('div')['id'],tablas.a.text,tablas.find_all('td')[3].text,tablas.find_all('td')[4].text)) for tablas in table[1:]]
        return clasificacion
1242809
def parse_standings(opt={})
      begin
        url = ParamsBuilder.build_link(opt)
        xml = fetch(url,"standings")
        data = []
        xml.xpath("//team").each do |inf|
        c = ScheduleLine.new

        inf.children.each do |child|
          if(child.is_a?(Nokogiri::XML::Element))
            #puts "#{child.name} - #{child.text}"
            #c.create_line({:name => child.name, :text => child.text})
            c.send("create_#{child.name}", child.text)

          end

          #c.send("#{child.name.to_s}=",child['data'])
        end
        data << c

        end
        return data
      rescue => e
        raise e
      end
    end
1369784
@Override
    public List<Team> getBoards() {
        int count = 0;
        int startAt = 0;
        boolean isLast = false;
        List<Team> result = new ArrayList<>();
        while (!isLast) {
            String url = featureSettings.getJiraBaseUrl() + (featureSettings.getJiraBaseUrl().endsWith("/") ? "" : "/")
                    + BOARD_TEAMS_REST_SUFFIX + "?startAt=" + startAt;
            try {
                ResponseEntity<String> responseEntity = makeRestCall(url);
                String responseBody = responseEntity.getBody();
                JSONObject teamsJson = (JSONObject) parser.parse(responseBody);

                if (teamsJson != null) {
                    JSONArray valuesArray = (JSONArray) teamsJson.get("values");
                    if (!CollectionUtils.isEmpty(valuesArray)) {
                        for (Object obj : valuesArray) {
                            JSONObject jo = (JSONObject) obj;
                            String teamId = getString(jo, "id");
                            String teamName = getString(jo, "name");
                            String teamType = getString(jo, "type");
                            Team team = new Team(teamId, teamName);
                            team.setTeamType(teamType);
                            team.setChangeDate("");
                            team.setAssetState("Active");
                            team.setIsDeleted("False");
                            result.add(team);
                            count = count + 1;
                        }
                        isLast = (boolean) teamsJson.get("isLast");
                        LOGGER.info("JIRA Collector collected " + count + " boards");
                        if (!isLast) {
                            startAt += JIRA_BOARDS_PAGING;
                        }
                    } else {
                        isLast = true;
                    }
                } else {
                    isLast = true;
                }
            } catch (ParseException pe) {
                isLast = true;
                LOGGER.error("Parser exception when parsing teams", pe);
            } catch (HygieiaException | HttpClientErrorException | HttpServerErrorException e) {
                isLast = true;
                LOGGER.error("Error in calling JIRA API: " + url , e.getMessage());
            }
        }
        return result;
    }
88077
def team_scores(self, team_scores, time):
        """"""
        data = []
        for score in team_scores['matches']:
            if score['status'] == 'FINISHED':
                item = {'date': score["utcDate"].split('T')[0],
                        'homeTeamName': score['homeTeam']['name'],
                        'goalsHomeTeam': score['score']['fullTime']['homeTeam'],
                        'goalsAwayTeam': score['score']['fullTime']['awayTeam'],
                        'awayTeamName': score['awayTeam']['name']}
                data.append(item)
        self.generate_output({'team_scores': data})
1079799
public function result()
    {

        // Don't bother if it didn't go well
        if ($this->_res == false) {
            return false;
        }

        // Store rows here
        $rows = [];

        // Table header
        $rows[] = array(
            'type' => 'header',
            'columns' => array(
                'Name',
                'Map',
                'Time Left',
                'Gametype',
                'Players',
            ),
        );

        // Have we?
        if (count($this->_res) == 0) {
            $rows[] = array('type' => 'none', 'columns' => array(array(5, 'None found')));
        }

        // We do
        else {

            // Go through each server
            foreach ($this->_res as $server) {

                // No players? Set player column to 'none'
                if ($server['info']['num_players'] == 0) {
                    $players = 'None';
                }

                // We do; populate a mini players table
                else {

                    // Show team column?
                    $show_team = in_array($server['info']['mode'], array(
                                'Infiltration',
                                'Capture the Flag',
                                'Teammatch',
                    ));

                    // Start table
                    $players = '
					<table class="mini" style="text-align: center;">
						<tr>
							<th>Name</th>'.(
                            $show_team ? '
							<th>Team</th>' : '').'
							<th>Score</th>
							<th>Deaths</th>
							<th>Ping</th>
						</tr>';

                    // Add each player to it
                    foreach ($server['info']['players'] as $player) {
                        $players .= '
						<tr'.($show_team ?  (' style="color: '.(
                        array_key_exists($player['team'], self::$team2color) ?
                            self::$team2color[$player['team']] : 'purple'
                        ).';"') : '').'>
							<td>'.htmlspecialchars($player['name']).'</td>'.(
                            $show_team ? '
							<td>'.(array_key_exists($player['team'], self::$team2name) ?
                                self::$team2name[$player['team']] : 'None').'</td>' : '').'
							<td>'.$player['kills'].'</td>
							<td>'.$player['deaths'].'</td>
							<td>'.$player['ping'].'</td>
						</tr>';
                    }

                    // End table
                    $players .= '
					</table>
					';
                }

                // Save result in master table
                $rows[] = array(
                    'type' => 'values',
                    'columns' => array(
                        $server['name'],
                        $server['info']['map'],
                        $server['info']['timeleft'],
                        $server['info']['mode'],
                        $players,
                    ),
                );
            }
        }

        // Give info
        return array(
            'root_title' => 'Soldat Servers',
            'rows' => $rows,
        );
    }
607992
def get_box_score_by_team(self, season, week, team_id):
        
        result = self._method_call("BoxScoreV3/{season}/{week}/{team_id}", "stats", season=season, week=week, team_id=team_id)
        return result
315302
private function determineOutcome()
    {
        $outcome = [];
        
        $players = $this->getPlayers();
        $opponents = $players;

        if ($players === false) {
            return false;
        }

        foreach ($players as $player) {
        
            foreach ($opponents as $opponent) {
    
                // dont play the player against themself
                if ($player->getId() === $opponent->getId())
                {
                    continue;
                }

                // move collection
                $player_move = $player->getLastMoveIndex();
                $opponent_move = $opponent->getLastMoveIndex();

                // verify moves have been set
                if (!is_array($player_move)) {
                    throw new RockPaperScissorsSpockLizardException($player->getName() . ' has not set a move!');
                }

                if (!is_array($opponent_move)) {
                    throw new RockPaperScissorsSpockLizardException($opponent->getName() . ' has not set a move!');
                }

                // move labels
                $player_move_label = ucfirst(key($player_move));
                $opponent_move_label = ucfirst(key($opponent_move));

                // map moves to an index
                $player_move_index = $this->getMoveIndex($player_move);
                $opponent_move_index = $this->getMoveIndex($opponent_move);

                // Exceptions
                if (!is_numeric($player_move_index)) {
                    throw new RockPaperScissorsSpockLizardException($player->getName() . ' made an illegal move!');
                }

                if (!is_numeric($opponent_move_index)) {
                    throw new RockPaperScissorsSpockLizardException($opponent->getName() . ' made an illegal move!');
                }

                if (current($player_move) === true) {
                    throw new RockPaperScissorsSpockLizardException($player->getName() . ' has already made this move!');
                }

                if (current($opponent_move) === true) {
                    throw new RockPaperScissorsSpockLizardException($opponent->getName() . ' has already made this move!');
                }

                // compare player with opponent
                if (isset($this->move_outcomes[$player_move_index][$opponent_move_index])) {
                    $outcome['winners'][] = [
                        'player' => $player,
                        'opponent' => $opponent,
                        'description' => $player_move_label . ' ' . $this->move_outcomes[$player_move_index][$opponent_move_index] . ' ' . $opponent_move_label
                    ];
                    $outcome['losers'][] = [
                        'player' => $opponent,
                        'opponent' => $player,
                        'description' => $player_move_label . ' ' . $this->move_outcomes[$player_move_index][$opponent_move_index] . ' ' . $opponent_move_label
                    ];
                } else if (isset($this->move_outcomes[$opponent_move_index][$player_move_index])) {
                    // dont do anything -- we just need to check this in order to determine whether a tie needs to be calculated
                } else {
                    // we just add the tie for the player since the opponent will be added to the ties on later iteration
                    $outcome['ties'][] = [
                        'player' => $player,
                        'opponent' => $opponent,
                        'description' => 'Both played ' . $player_move_label
                    ];
                }
            }
        }

        // mark last moves as played
        foreach ($players as $player) {
            $player->lastMoveIsPlayed();
        }
        
        $this->setOutcome($outcome);
        
        return $this->getRoundOutcome();
    }