Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/models/package_rating.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ def self.calculate_average(package_id, aspect=nil)
package_id]).to_f
end
end

#Package ratings should take into account number of users and their ratings
def self.calculate_rating(package_id, aspect=nil)
self.sum(sqrt('rating'*count('users'))).to_f
end

def to_s
rating.to_s
Expand Down