#NEWLINE# def player_stats( self ) : #NEWLINE# #INDENT# '\n        Generates the player stats for player listings\n        ' #NEWLINE# total_points = 0.0 #NEWLINE# games = 0.0 #NEWLINE# won_count = 0 #NEWLINE# for result in self . player . result_player . filter ( player = self . player , ladder = self . ladder ) : #NEWLINE# #INDENT# if ( result . result == 9 ) : #NEWLINE# #INDENT# total_points += ( ( result . result + 2 ) + 1 ) #NEWLINE# won_count += 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# total_points += ( result . result + 1 ) #NEWLINE# #UNINDENT# games += 1 #NEWLINE# #UNINDENT# if ( games > 0 ) : #NEWLINE# #INDENT# pointsdivgames = ( total_points / games ) #NEWLINE# percplayed = ( ( games / ( self . ladder . league_set . count ( ) - 1 ) ) * 100 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# percplayed = pointsdivgames = 0 #NEWLINE# #UNINDENT# return { #NEWLINE# #INDENT# 'total_points' : total_points , #NEWLINE# 'games' : games , #NEWLINE# 'pointsdivgames' : pointsdivgames , #NEWLINE# 'won_count' : won_count , #NEWLINE# 'percplayed' : percplayed , #NEWLINE# #UNINDENT# }