Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculated and added Season Total Rankings for Optimal Points section #226

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions report/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,15 @@ def create_pdf_report(self) -> Path:
team_luck_data_entry.append(team.weekly_overall_record.get_record_str())

# add season total optimal points to optimal points data
sorted_season_total_optimal_points_data = dict(sorted(season_total_optimal_points_data.items(), key=lambda x: x[1], reverse=True))
list_sorted_season_total_optimal_points_data = [(i, k, v) for i, (k, v) in enumerate(sorted_season_total_optimal_points_data.items())]
for team_optimal_points_data_entry in report_data.data_for_optimal_scores:
for team_name, season_total_optimal_points in season_total_optimal_points_data.items():
for team_index, team_name, season_total_optimal_points in list_sorted_season_total_optimal_points_data:
if team_optimal_points_data_entry[1] == team_name:
team_optimal_points_data_entry.append(f"{round(season_total_optimal_points, 2):.2f}")
place = team_index + 1
total_optimal_points_ranked = str("{:.2f}".format(round(season_total_optimal_points, 2))) + " (" + str(place) +")"
team_optimal_points_data_entry.append(total_optimal_points_ranked)


report_data.data_for_power_rankings = season_average_calculator.get_average(
time_series_power_rank_data,
Expand Down
2 changes: 1 addition & 1 deletion report/pdf/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def __init__(self, season: int, league: BaseLeague, playoff_prob_sims: int,
self.scores_headers = [["Place", "Team", "Manager", "Points", "Season Avg. (Place)"]]
self.efficiency_headers = [["Place", "Team", "Manager", "Coaching Efficiency (%)", "Season Avg. (Place)"]]
self.luck_headers = [["Place", "Team", "Manager", "Luck", "Season Avg. (Place)", "Weekly Record (W-L)"]]
self.optimal_scores_headers = [["Place", "Team", "Manager", "Optimal Points", "Season Total"]]
self.optimal_scores_headers = [["Place", "Team", "Manager", "Optimal Points", "Season Total (Place)"]]
self.bad_boy_headers = [["Place", "Team", "Manager", "Bad Boy Pts", "Worst Offense", "# Offenders"]]
self.beef_headers = [["Place", "Team", "Manager", "TABBU(s)"]]
self.high_roller_headers = [[
Expand Down