21 lines
663 B
Ruby
21 lines
663 B
Ruby
class WelcomeController < ApplicationController
|
|
def home
|
|
@newest_upload = Screenshot.where(approved: true).first
|
|
|
|
@most_popular_package = Package.with_screenshots.order(visits: :desc).first
|
|
|
|
@package_count = Package.count
|
|
|
|
# Get up 100 screenshots where the packages have the most visits
|
|
query = Package.without_screenshots.order(visits: :desc)
|
|
count = query.count
|
|
random_offset = rand( [100, count].min )
|
|
@most_wanted_package = query.offset(random_offset).first
|
|
end
|
|
|
|
def about
|
|
@package_sources = Rails.configuration.package_sources
|
|
@package_count = Package.count
|
|
@screenshot_count = Screenshot.count
|
|
end
|
|
end
|