mirror of
https://github.com/SrIzan10/hc-harbor.git
synced 2026-05-01 10:45:21 +00:00
Only show untracked warning if user isn't on leaderboard
This commit is contained in:
@@ -12,12 +12,15 @@ class LeaderboardsController < ApplicationController
|
||||
|
||||
tracked_user_ids = @leaderboard.entries.distinct.pluck(:slack_uid)
|
||||
|
||||
today = Time.current
|
||||
@untracked_entries = Hackatime::Heartbeat
|
||||
.where(time: today.beginning_of_day..today.end_of_day)
|
||||
.distinct
|
||||
.pluck(:user_id)
|
||||
.count { |user_id| !tracked_user_ids.include?(user_id) }
|
||||
@user_on_leaderboard = current_user && tracked_user_ids.include?(current_user.slack_uid)
|
||||
unless @user_on_leaderboard
|
||||
today = Time.current
|
||||
@untracked_entries = Hackatime::Heartbeat
|
||||
.where(time: today.beginning_of_day..today.end_of_day)
|
||||
.distinct
|
||||
.pluck(:user_id)
|
||||
.count { |user_id| !tracked_user_ids.include?(user_id) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -29,12 +29,14 @@
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>
|
||||
Don't see yourself on the leaderboard? You're probably one of the
|
||||
<%= pluralize(@untracked_entries, "user") %>
|
||||
who haven't
|
||||
<%= link_to "updated their wakatime config", my_settings_path, target: "_blank" %>.
|
||||
</p>
|
||||
<% unless @user_on_leaderboard %>
|
||||
<p>
|
||||
Don't see yourself on the leaderboard? You're probably one of the
|
||||
<%= pluralize(@untracked_entries, "user") %>
|
||||
who haven't
|
||||
<%= link_to "updated their wakatime config", my_settings_path, target: "_blank" %>.
|
||||
</p>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="empty-state">
|
||||
<h3>No data available</h3>
|
||||
|
||||
Reference in New Issue
Block a user