File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -1195,6 +1195,23 @@ def get_queryset(self):
11951195 # Apply the user filter
11961196 qs = self .get_filtered_queryset (qs )
11971197
1198+ qs = qs .extra (
1199+ select = {
1200+ "average_vote" : "rating_score / (rating_votes + 0.001)" ,
1201+ "latest_version_date" : (
1202+ "SELECT created_on FROM plugins_pluginversion WHERE "
1203+ "plugins_pluginversion.plugin_id = plugins_plugin.id "
1204+ "AND approved = TRUE "
1205+ "ORDER BY created_on DESC LIMIT 1"
1206+ ),
1207+ "weighted_rating" : (
1208+ "((rating_votes::FLOAT / (rating_votes + 5)) * "
1209+ "(rating_score::FLOAT / (rating_votes + 0.001))) + "
1210+ "((5::FLOAT / (rating_votes + 5)) * 3)"
1211+ ),
1212+ }
1213+ )
1214+
11981215 # Handle sorting (copied from parent class)
11991216 sort_by = self .request .GET .get ("sort" , None )
12001217 sort_order = self .request .GET .get ("order" , None )
You can’t perform that action at this time.
0 commit comments