mirror of
https://github.com/SrIzan10/hc-harbor.git
synced 2026-05-01 10:45:21 +00:00
Only show logged time sentence if there is logged time!
(duh)
This commit is contained in:
@@ -37,6 +37,7 @@ class StaticPagesController < ApplicationController
|
||||
|
||||
@todays_languages = language_counts.map(&:first)
|
||||
@todays_editors = editor_counts.map(&:first)
|
||||
@show_logged_time_sentence = @todays_languages.any? || @todays_editors.any?
|
||||
|
||||
# Get today's leaderboard
|
||||
@leaderboard = Leaderboard.find_by(start_date: Date.current, deleted_at: nil)
|
||||
|
||||
@@ -10,23 +10,28 @@
|
||||
</p>
|
||||
<% end %>
|
||||
<% if current_user %>
|
||||
You've logged
|
||||
<%= short_time_detailed current_user.heartbeats.today.duration_seconds %>
|
||||
<% if @todays_languages.any? || @todays_editors.any? %>
|
||||
across
|
||||
<% if @todays_languages.any? %>
|
||||
<% if @todays_languages.length >= 4 %>
|
||||
<%= @todays_languages[0..1].join(", ") %> <span title="<%= @todays_languages[2..].join(", ") %>">(& <%= pluralize(@todays_languages.length - 2, 'other language') %>)</span>
|
||||
<% else %>
|
||||
<%= @todays_languages.to_sentence %>
|
||||
|
||||
<% if @show_logged_time_sentence %>
|
||||
You've logged
|
||||
<%= short_time_detailed current_user.heartbeats.today.duration_seconds %>
|
||||
<% if @todays_languages.any? || @todays_editors.any? %>
|
||||
across
|
||||
<% if @todays_languages.any? %>
|
||||
<% if @todays_languages.length >= 4 %>
|
||||
<%= @todays_languages[0..1].join(", ") %> <span title="<%= @todays_languages[2..].join(", ") %>">(& <%= pluralize(@todays_languages.length - 2, 'other language') %>)</span>
|
||||
<% else %>
|
||||
<%= @todays_languages.to_sentence %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if @todays_languages.any? && @todays_editors.any? %>
|
||||
using
|
||||
<% end %>
|
||||
<% if @todays_editors.any? %>
|
||||
<%= @todays_editors.to_sentence %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if @todays_languages.any? && @todays_editors.any? %>
|
||||
using
|
||||
<% end %>
|
||||
<% if @todays_editors.any? %>
|
||||
<%= @todays_editors.to_sentence %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
No time logged today... but you can change that!
|
||||
<% end %>
|
||||
|
||||
<% if @leaderboard %>
|
||||
|
||||
Reference in New Issue
Block a user