Fixed class and instance methods for pending screenshots/packages
This commit is contained in:
parent
d4f3c2ecc5
commit
c9469709d6
1 changed files with 7 additions and 2 deletions
|
|
@ -33,12 +33,17 @@ class Package < ActiveRecord::Base
|
|||
end
|
||||
|
||||
# Return a query of all approved/public screenshots of this package
|
||||
def self.screenshots_approved
|
||||
def screenshots_approved
|
||||
self.screenshots.find_by(approved: true)
|
||||
end
|
||||
|
||||
# Return a query of all approved/public screenshots of this package
|
||||
def screenshots_pending
|
||||
self.screenshots.find_by(approved: false)
|
||||
end
|
||||
|
||||
# Return a list of packages that have unapproved screenshots
|
||||
def self.requiring_moderation
|
||||
Package.joins(:screenshots).where(screenshots: {approved:false}).group('packages.id')
|
||||
self.joins(:screenshots).where(screenshots: {approved:false}).distinct(:name)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue