Attempt to fix name lookup for sailorslog leaderboard

This commit is contained in:
Max Wofford
2025-03-26 02:52:18 -04:00
parent 1395c12d4a
commit 9ad3f1e73f

View File

@@ -12,7 +12,7 @@ class SailorsLogLeaderboard < ApplicationRecord
stats.each_with_index do |entry, index|
medal = medals[index] || "white_small_square"
msg += "\n:#{medal}: `@#{SlackUsername.find_by_uid(entry[:user_id])}`: #{short_time_simple entry[:duration]}"
msg += "\n:#{medal}: `@#{entry[:name]}`: #{short_time_simple entry[:duration]}"
msg += entry[:projects].map do |project|
language = project[:language_emoji] ? "#{project[:language_emoji]} #{project[:language]}" : project[:language]
@@ -76,8 +76,10 @@ class SailorsLogLeaderboard < ApplicationRecord
projects = projects.filter { |project| project[:duration] > 1.minute }.sort_by { |project| -project[:duration] }
user = User.find user_id
{
user_id: user_id,
slack_uid: user.slack_uid,
name: SlackUsername.find_by_uid(user.slack_uid),
duration: user_durations[user_id],
projects: projects
}