Skip to content
This repository has been archived by the owner on Sep 22, 2020. It is now read-only.

Commit

Permalink
Adjust rating sort algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
TigerHix committed Jan 10, 2020
1 parent c4f49ab commit 2c3bb55
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/controllers/levels.ts
Expand Up @@ -241,7 +241,8 @@ export default class LevelController extends BaseController {
'levels.modificationDate',
'levels.creationDate',
'json_agg(charts ORDER BY charts.difficulty) as charts',
'(SELECT avg(level_ratings.rating) FROM level_ratings WHERE level_ratings."levelId"=levels.id) as rating',
'(SELECT (60 + avg(level_ratings.rating) * count(level_ratings.rating)) * 1.0 ' +
'/ (10 + count(level_ratings.rating)) FROM level_ratings WHERE level_ratings."levelId"=levels.id) as rating',
'(SELECT count(*) FROM level_downloads WHERE "levelId"=levels.id) as downloads',
'(SELECT count(*) FROM records ' +
'JOIN charts ON charts.id=records."chartId" ' +
Expand Down

0 comments on commit 2c3bb55

Please sign in to comment.