#NEWLINE# def get_stats( self ) : #NEWLINE# #INDENT# '\n        Generates the season stats\n        ' #NEWLINE# player_count = 0 #NEWLINE# results_count = 0 #NEWLINE# total_games_count = 0.0 #NEWLINE# for ladder in self . ladder_set . all ( ) : #NEWLINE# #INDENT# player_count += ladder . league_set . count ( ) #NEWLINE# results_count += ( ladder . result_set . count ( ) / 2 ) #NEWLINE# total_games_count += ( ( ladder . league_set . count ( ) * ( ladder . league_set . count ( ) - 1 ) ) / 2 ) #NEWLINE# #UNINDENT# percentage_played = ( ( total_games_count / total_games_count ) * 100 ) #NEWLINE# return { #NEWLINE# #INDENT# 'divisions' : self . ladder_set . count ( ) , #NEWLINE# 'percentage_played' : '{0:.2f}' . format ( percentage_played ) , #NEWLINE# 'total_games_count' : total_games_count , #NEWLINE# 'results_count' : results_count , #NEWLINE# 'player_count' : player_count , #NEWLINE# #UNINDENT# }