From 65752b4f73cf8e1ce83cdaf8227b5d67923ac729 Mon Sep 17 00:00:00 2001 From: David Gay Date: Fri, 28 May 2021 21:45:50 -0400 Subject: Quickly port leaderboard and rankings from old Esoterra --- app/controllers/characters/rankings_controller.rb | 9 +++++++++ app/controllers/leaderboard_controller.rb | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 app/controllers/characters/rankings_controller.rb create mode 100644 app/controllers/leaderboard_controller.rb (limited to 'app/controllers') diff --git a/app/controllers/characters/rankings_controller.rb b/app/controllers/characters/rankings_controller.rb new file mode 100644 index 0000000..bbae9fc --- /dev/null +++ b/app/controllers/characters/rankings_controller.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class Characters::RankingsController < ApplicationController + skip_before_action :authenticate_user! + + def index + @character = Character.find(params[:character_id]) + end +end \ No newline at end of file diff --git a/app/controllers/leaderboard_controller.rb b/app/controllers/leaderboard_controller.rb new file mode 100644 index 0000000..e6e8543 --- /dev/null +++ b/app/controllers/leaderboard_controller.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class LeaderboardController < ApplicationController + def index + @top_per_skill = Hash[Skill.all.map { |s| [s.name.to_sym, CharacterSkill.top_xp_for(s)] }] + @top_total_xp = Character.top_total_xp + @top_total_level = Character.top_total_level + end +end -- cgit v1.2.3