mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
show stats by days
This commit is contained in:
parent
5b13244712
commit
bf61a5384e
2 changed files with 18 additions and 5 deletions
15
app/site.rb
15
app/site.rb
|
@ -82,8 +82,21 @@ get '/site/:username/stats' do
|
|||
location_hash
|
||||
end
|
||||
|
||||
@stats[:stat_days] = @site.stats_dataset.order(:created_at.desc).limit(7).all.reverse
|
||||
stats_dataset = @site.stats_dataset.order(:created_at.desc)
|
||||
|
||||
if @site.supporter?
|
||||
unless params[:days].to_s == 'sincethebigbang'
|
||||
if params[:days]
|
||||
stats_dataset.limit! params[:days]
|
||||
else
|
||||
stats_dataset.limit! 7
|
||||
end
|
||||
end
|
||||
else
|
||||
stats_dataset.limit! 7
|
||||
end
|
||||
|
||||
@stats[:stat_days] = stats_dataset.all.reverse
|
||||
@multi_tooltip_template = "<%= datasetLabel %> - <%= value %>"
|
||||
|
||||
erb :'site/stats', locals: {site: @site}
|
||||
|
|
|
@ -139,10 +139,10 @@
|
|||
|
||||
<% if current_site.supporter? %>
|
||||
<ul class="nav h-Nav">
|
||||
<li><a href="">1 month</a></li>
|
||||
<li><a href="">3 months</a></li>
|
||||
<li><a href="">1 year</a></li>
|
||||
<li><a href="">All time</a></li>
|
||||
<li><a href="?days=30">30 days</a></li>
|
||||
<li><a href="?days=90">90 days</a></li>
|
||||
<li><a href="?days=365">1 year</a></li>
|
||||
<li><a href="?days=sincethebigbang">All time</a></li>
|
||||
</ul>
|
||||
<% else %>
|
||||
<p>(<a href="/plan">Upgrade</a> to see up to see stats for all time)</p>
|
||||
|
|
Loading…
Add table
Reference in a new issue