Skip to content

Commit

Permalink
Merge pull request #226 from cdpeca/feature(optimal_score_rank)
Browse files Browse the repository at this point in the history
Calculated and added Season Total Rankings for Optimal Points section
  • Loading branch information
uberfastman authored Oct 18, 2024
2 parents 150ca7a + b1d97ba commit 9ef8e9c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
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 @@ -436,7 +436,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

0 comments on commit 9ef8e9c

Please sign in to comment.