My simplified domain model in grails is like this:
Article {
Integer totalViews
static hasMany = [
ratings: Rating
]
}
Rating {
Integer value // 1 to 5
User user
}
I am trying to find the 5 most popular articles based on totalViews and ratings, say 25% weightage on views and 75% weightage on ratings.
How would you do it in Groovy/Grails?