#NEWLINE# def get_review_stats( ) : #NEWLINE# #INDENT# results = [ ] #NEWLINE# problems = api . problem . get_all_problems ( ) #NEWLINE# for p in problems : #NEWLINE# #INDENT# timespent = 0 #NEWLINE# enjoyment = 0 #NEWLINE# difficulty = 0 #NEWLINE# edval = 0 #NEWLINE# counter = 0 #NEWLINE# for item in api . problem_feedback . get_problem_feedback ( pid = p [ 'pid' ] ) : #NEWLINE# #INDENT# counter += 1 #NEWLINE# metrics = item [ 'feedback' ] [ 'metrics' ] #NEWLINE# edval += metrics [ 'educational-value' ] #NEWLINE# difficulty += metrics [ 'difficulty' ] #NEWLINE# enjoyment += metrics [ 'enjoyment' ] #NEWLINE# timespent += item [ 'feedback' ] [ 'timeSpent' ] #NEWLINE# #UNINDENT# if ( counter > 0 ) : #NEWLINE# #INDENT# results . append ( { #NEWLINE# #INDENT# 'name' : p [ 'name' ] , #NEWLINE# 'education' : ( edval / counter ) , #NEWLINE# 'difficulty' : ( difficulty / counter ) , #NEWLINE# 'enjoyment' : ( enjoyment / counter ) , #NEWLINE# 'time' : ( timespent / counter ) , #NEWLINE# 'votes' : counter , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# #UNINDENT# return results