This commit is contained in:
Christoph Haas 2021-03-10 01:04:43 +01:00
parent 5d0e4a520e
commit f9130c6972
2 changed files with 0 additions and 33 deletions

View file

@ -56,7 +56,6 @@ class Package < ApplicationRecord
Package.joins(:screenshots).where('screenshots.approved=false').distinct(:name)
end
# Return a query of all packages that do not have screenshots
def self.without_screenshots
# Query for all packages who's ID does not appear in a screenshot's "package_id" field
@ -64,21 +63,6 @@ class Package < ApplicationRecord
where.not(id: subselect)
end
# Return a query of all approved/public screenshots of this package
def screenshots_approved
self.screenshots.where(approved: true)
end
# Return a query of all approved/public screenshots of this package
def screenshots_pending
self.screenshots.where(approved: false)
end
# Return a list of packages that have unapproved screenshots
def self.requiring_moderation
self.joins(:screenshots).where(screenshots: {approved:false}).distinct(:name)
end
# Get all screenshots and have them sorted descendingly by their version number (Debian style).
def screenshots_sorted_by_version
self.screenshots.to_a.sort { |x,y| version_compare(x.version,y.version) }