Update to Rails 7.2
This commit is contained in:
parent
932a43daac
commit
25672aabb0
31 changed files with 836 additions and 435 deletions
|
|
@ -341,7 +341,7 @@ class PackagesController < ApplicationController
|
|||
|
||||
# Return packages matching the criteria given by parameters
|
||||
def query_packages
|
||||
packages = Package.order(visits: :desc)
|
||||
packages = Package #.order(visits: :desc)
|
||||
|
||||
# text search
|
||||
if params[:search].present?
|
||||
|
|
@ -352,7 +352,7 @@ class PackagesController < ApplicationController
|
|||
case params[:show]
|
||||
when 'with'
|
||||
# Enrich the result with the screenshots readable by the current user (CanCanCan)
|
||||
packages = packages.with_screenshots
|
||||
packages = packages.with_public_screenshots
|
||||
logger.debug 'Limiting packages to those with screenshots'
|
||||
when 'without'
|
||||
packages = packages.without_screenshots
|
||||
|
|
|
|||
|
|
@ -4,12 +4,13 @@ class WelcomeController < ApplicationController
|
|||
def home
|
||||
@newest_upload = Screenshot.where(approved: true).first
|
||||
|
||||
@most_popular_package = Package.with_screenshots.order(visits: :desc).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 )
|
||||
@most_wanted_package = query.offset(random_offset).first
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue