lab
This commit is contained in:
parent
7cd9c68a10
commit
36984ff1d4
20 changed files with 321 additions and 391 deletions
|
|
@ -4,15 +4,15 @@ class WelcomeController < ApplicationController
|
|||
def home
|
||||
@newest_upload = Screenshot.where(approved: true).first
|
||||
|
||||
#@most_popular_package = Package.with_screenshots.order(visits: :desc).first
|
||||
@random_pick = Package.with_public_screenshots.order("RANDOM()").first
|
||||
# @most_popular_package = Package.with_screenshots.order(visits: :desc).first
|
||||
@random_pick = Package.with_public_screenshots.order('RANDOM()').first
|
||||
|
||||
@package_count = Package.count
|
||||
|
||||
# Get up 100 screenshots where the packages have the most visits
|
||||
query = Package.without_screenshots #.order(visits: :desc)
|
||||
query = Package.without_screenshots # .order(visits: :desc)
|
||||
count = query.count
|
||||
random_offset = rand( [100, count].min )
|
||||
random_offset = rand([100, count].min)
|
||||
@most_wanted_package = query.offset(random_offset).first
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue