summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2021-05-28 21:45:50 -0400
committerDavid Gay <david@davidgay.org>2021-05-28 21:45:50 -0400
commit65752b4f73cf8e1ce83cdaf8227b5d67923ac729 (patch)
tree5aa91176d33e828a7c70f122f87946948c884026 /app/controllers
parentca98987c1a14655aedb4bdcf8fef7311131ca1be (diff)
Quickly port leaderboard and rankings from old Esoterra
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/characters/rankings_controller.rb9
-rw-r--r--app/controllers/leaderboard_controller.rb9
2 files changed, 18 insertions, 0 deletions
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