mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
bad randomizing algorithm
This commit is contained in:
parent
ee7a86ffe3
commit
79ba7aa4f8
2 changed files with 3 additions and 0 deletions
2
app.rb
2
app.rb
|
@ -46,6 +46,8 @@ get '/browse' do
|
|||
site_dataset.order!(:created_at.desc)
|
||||
when 'oldest'
|
||||
site_dataset.order!(:created_at)
|
||||
when 'random'
|
||||
site_dataset.where! 'random() < 0.01'
|
||||
else
|
||||
params[:sort_by] = 'last_updated'
|
||||
site_dataset.order!(:updated_at.desc, :hits.desc)
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
<option value="hits" <%= 'selected' if params[:sort_by] == 'hits' %>>Most Hits</option>
|
||||
<option value="newest" <%= 'selected' if params[:sort_by] == 'newest' %>>Newest</option>
|
||||
<option value="oldest" <%= 'selected' if params[:sort_by] == 'oldest' %>>Oldest</option>
|
||||
<option value="random" <%= 'selected' if params[:sort_by] == 'random' %>>Random</option>
|
||||
</select>
|
||||
</div>
|
||||
<!--
|
||||
|
|
Loading…
Add table
Reference in a new issue