updated weekly leaderboard html and frequency of good job

updates
This commit is contained in:
Karthik Sankar
2025-03-12 12:32:54 +00:00
committed by Max Wofford
parent fa416b3842
commit a0c25ec545
3 changed files with 35 additions and 10 deletions

View File

@@ -1,16 +1,28 @@
<div class="leaderboard">
<div class="header">
<h1>Today's Leaderboard</h1>
<h1>Leaderboard</h1>
<div class="period-toggle">
<%= link_to "Daily", leaderboards_path(period_type: 'daily'),
class: "period-toggle-btn #{@period_type == :daily ? 'active' : ''}" %>
<%= link_to "Weekly", leaderboards_path(period_type: 'weekly'),
class: "period-toggle-btn #{@period_type == :weekly ? 'active' : ''}" %>
</div>
<p class="date">
<%= Date.current.strftime("%B %d, %Y") %>
<% unless @leaderboard.nil? %>
<% if @leaderboard %>
<%= @leaderboard.date_range_text %>
<em>Updated <%= time_ago_in_words(@leaderboard.updated_at) %> ago</em>
<% else %>
<%= @period_type == :weekly ?
"#{Date.current.beginning_of_week.strftime('%B %d')} - #{(Date.current.beginning_of_week + 6.days).strftime('%B %d, %Y')}" :
Date.current.strftime("%B %d, %Y") %>
<% end %>
</p>
</div>
<div class="content">
<% if @entries.any? %>
<% if @entries&.any? %>
<table>
<thead>
<tr>
@@ -40,8 +52,8 @@
<% else %>
<div class="empty-state">
<h3>No data available</h3>
<p>Check back later for today's results!</p>
<p>Check back later for <%= @period_type == :weekly ? "this week's" : "today's" %> results!</p>
</div>
<% end %>
</div>
</div>
</div>

View File

@@ -8,9 +8,15 @@ Rails.application.configure do
cron: "*/5 * * * *",
class: "UserSlackStatusUpdateJob"
},
leaderboard_update: {
cron: "*/5 * * * *",
class: "LeaderboardUpdateJob"
daily_leaderboard_update: {
cron: "0 0 * * *",
class: "LeaderboardUpdateJob",
args: [-> { Date.current.to_s }, "daily"]
},
weekly_leaderboard_update: {
cron: "0 0 * * 1",
class: "LeaderboardUpdateJob",
args: [-> { Date.current.beginning_of_week.to_s }, "weekly"]
},
sailors_log_poll: {
cron: "* * * * *",
@@ -21,4 +27,4 @@ Rails.application.configure do
class: "SlackCommand::UpdateSlackChannelCacheJob"
}
}
end
end

7
db/schema.rb generated
View File

@@ -170,6 +170,13 @@ ActiveRecord::Schema[8.0].define(version: 2025_03_13_205725) do
t.datetime "updated_at", null: false
t.datetime "finished_generating_at"
t.datetime "deleted_at"
t.integer "period_type", default: 0, null: false
end
create_table "project_labels", id: :serial, force: :cascade do |t|
t.text "user_id"
t.text "project_key"
t.text "label"
end
create_table "project_repo_mappings", force: :cascade do |t|