mirror of
https://github.com/System-End/hackatime.git
synced 2026-04-19 19:55:16 +00:00
Only show untracked warning if user isn't on leaderboard
This commit is contained in:
parent
89d5ddeba7
commit
f5fad7ae49
2 changed files with 17 additions and 12 deletions
|
|
@ -12,6 +12,8 @@ class LeaderboardsController < ApplicationController
|
|||
|
||||
tracked_user_ids = @leaderboard.entries.distinct.pluck(:slack_uid)
|
||||
|
||||
@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)
|
||||
|
|
@ -20,4 +22,5 @@ class LeaderboardsController < ApplicationController
|
|||
.count { |user_id| !tracked_user_ids.include?(user_id) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -29,12 +29,14 @@
|
|||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% 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>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue