diff --git a/lib/gamification_plugin/dashboard_helper.rb b/lib/gamification_plugin/dashboard_helper.rb index a17586a..e5cd7ec 100644 --- a/lib/gamification_plugin/dashboard_helper.rb +++ b/lib/gamification_plugin/dashboard_helper.rb @@ -19,10 +19,10 @@ module GamificationPlugin::DashboardHelper # FIXME move these queries to profile model ranking = Profile.select('profiles.*, sum(num_points) as gamification_points, ROW_NUMBER() OVER(order by sum(num_points) DESC) as gamification_position').joins(:sash => {:scores => :score_points}).where(:type => 'Person').order('sum(num_points) DESC').group('profiles.id') ranking = ranking.where("merit_score_points.created_at >= ?", from_date) if from_date.present? - current_person_ranking = Profile.from("(#{ranking.to_sql}) profiles").where('profiles.id' => current_person.id).first + profile_ranking = Profile.from("(#{ranking.to_sql}) profiles").where('profiles.id' => profile.id).first ranking = ranking.limit(limit) - render :partial => 'gamification/ranking', :locals => {:ranking => ranking, :current_person_ranking => current_person_ranking} + render :partial => 'gamification/ranking', :locals => {:ranking => ranking, :profile_ranking => profile_ranking} end end diff --git a/views/gamification/_ranking.html.erb b/views/gamification/_ranking.html.erb index f2c2a58..136872e 100644 --- a/views/gamification/_ranking.html.erb +++ b/views/gamification/_ranking.html.erb @@ -1,7 +1,7 @@