Exemple #1
0
def _print_tournament_data(match_date, tournament_id):
    content = ''

    whole_match_headers = get_match_headers()
    attainable_match_headers = whole_match_headers[ whole_match_headers['date'] <= eve_datetime(match_date) ]

    first_year = match_date.year if match_date.month >= 6 else match_date.year - 1
    tournament_season_match_headers = get_tournament_season_substatistic(attainable_match_headers, tournament_id, first_year)
    sorted_tournament_season_match_headers = tournament_season_match_headers.sort_values('date', ascending=True)

    home_teams = frozenset(tournament_season_match_headers['home'].values)
    away_teams = frozenset(tournament_season_match_headers['away'].values)
    teams = home_teams | away_teams

    data = { home: { away: None for away in teams } for home in teams }
    for (match_uuid, match_header) in sorted_tournament_season_match_headers.iterrows():
        events_counts = count_events_of_teams_by_match_uuid(is_corner, match_uuid)
        if events_counts is None:
            continue
        first_period_events_counts = count_events_of_teams_by_match_uuid(conjunct(is_corner, is_first_period), match_uuid)
        second_period_events_counts = count_events_of_teams_by_match_uuid(conjunct(is_corner, is_second_period), match_uuid)

        data[ match_header['home'] ][ match_header['away'] ] = (events_counts[0], events_counts[1], first_period_events_counts[0], first_period_events_counts[1], second_period_events_counts[0], second_period_events_counts[1])

    content += '<table>'
    content += '<tbody>'

    content += '<tr>'
    content += '<th></th>'
    for team in sorted(teams):
        content += '<th>' + team + '</th>'
    content += '</tr>'

    for home in sorted(teams):
        content += '<tr>'
        content += '<th>' + home + '</th>'
        for away in sorted(teams):
            match_data = data[home][away]
            if match_data is not None:
                content += '<td>%u : %u (%u : %u / %u : %u)</td>' % match_data
            else:
                content += '<td></td>'
        content += '</tr>'

    content += '</table>'

    return content
Exemple #2
0
def _print_teams_statistic(match_header, is_home):
    content = ''

    team = match_header['home'] if is_home else match_header['away']

    whole_match_headers = get_match_headers()
    attainable_match_headers = whole_match_headers[ whole_match_headers['date'] <= eve_datetime(match_header['date']) ]
    attainable_team_match_headers = attainable_match_headers[ (attainable_match_headers['home'] == team) | (attainable_match_headers['away'] == team) ]
    last_match_headers = attainable_team_match_headers[:10]

    content += '<table>'
    content += '<thead>'
    content += '<tr>'
    content += '<th>Дата</th>'
    content += '<th>Хозяева</th>'
    content += '<th>Гости</th>'
    content += '<th>Угловые (матч)</th>'
    content += '<th>Угловые (1-й тайм)</th>'
    content += '<th>Угловые (2-й тайм)</th>'
    content += '</tr>'
    content += '</thead>'
    content += '<tbody>'

    for (match_uuid, match_header) in last_match_headers.iterrows():
        corners_counts = count_events_of_teams_by_match_uuid(is_corner, match_uuid)
        if corners_counts is None:
            continue
        first_period_corners_counts = count_events_of_teams_by_match_uuid(conjunct(is_corner, is_first_period), match_uuid)
        second_period_corners_counts = count_events_of_teams_by_match_uuid(conjunct(is_corner, is_second_period), match_uuid)

        if (is_home and match_header['home'] == team) or (not is_home and match_header['away'] == team):
            content += '<tr class="active">'
        else:
            content += '<tr>'
        content += '<td>' + match_header['date'].strftime('%Y-%m-%d') + '</td>'
        content += '<td>' + match_header['home'] + '</td>'
        content += '<td>' + match_header['away'] + '</td>'
        content += '<td>%u : %u</td>' % corners_counts
        content += '<td>%u : %u</td>' % first_period_corners_counts
        content += '<td>%u : %u</td>' % second_period_corners_counts
        content += '</tr>'

    content += '</tbody>'
    content += '</table>'

    return content
    def _get_match_statistic_data(self, match_header):
        (corners_first_period_home_count, corners_first_period_away_count) = count_events_of_teams_by_match_uuid(conjunct(is_corner, is_first_period, is_goals_score_2), match_header['uuid'])

        match_statistic_data = {
            'events_home_count': corners_first_period_home_count,
            'events_away_count': corners_first_period_away_count
        }

        return match_statistic_data
Exemple #4
0
    def _get_match_statistic_data(self, match_header):
        (corners_home_count, corners_away_count) = count_events_of_teams_by_match_uuid(is_corner, match_header['uuid'])

        match_statistic_data = {
            'events_home_count': corners_home_count,
            'events_away_count': corners_away_count
        }

        return match_statistic_data
    def _get_match_statistic_data(self, match_header):
        (red_cards_second_period_home_count, red_cards_second_period_away_count
         ) = count_events_of_teams_by_match_uuid(
             conjunct(is_red_card, is_second_period), match_header['uuid'])

        match_statistic_data = {
            'events_home_count': red_cards_second_period_home_count,
            'events_away_count': red_cards_second_period_away_count
        }

        return match_statistic_data
    def _get_match_statistic_data(self, match_header):
        (crosses_first_period_home_count, crosses_first_period_away_count
         ) = count_events_of_teams_by_match_uuid(
             conjunct(is_cross, is_first_period), match_header['uuid'])

        match_statistic_data = {
            'events_home_count': crosses_first_period_home_count,
            'events_away_count': crosses_first_period_away_count
        }

        return match_statistic_data
    def _get_match_statistic_data(self, match_header):
        (yellow_cards_home_count,
         yellow_cards_away_count) = count_events_of_teams_by_match_uuid(
             is_yellow_card, match_header['uuid'])

        match_statistic_data = {
            'events_home_count': yellow_cards_home_count,
            'events_away_count': yellow_cards_away_count
        }

        return match_statistic_data