diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-09-24 12:13:15 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-24 12:13:15 +0300 |
| commit | 6f28f28ecd899fd7f90df42528ef178a94f6677d (patch) | |
| tree | fbb00e75a5074e63028d31e1c90475d2d7d2d7cc /backend/handlers/map.go | |
| parent | fix: delete demo if parsing goes wrong (#90) (diff) | |
| download | lphub-6f28f28ecd899fd7f90df42528ef178a94f6677d.tar.gz lphub-6f28f28ecd899fd7f90df42528ef178a94f6677d.tar.bz2 lphub-6f28f28ecd899fd7f90df42528ef178a94f6677d.zip | |
feat: removing (by flag) records (#56)
Former-commit-id: cc1bed84ee7ff9133192e1278c8315afee73d23a
Diffstat (limited to 'backend/handlers/map.go')
| -rw-r--r-- | backend/handlers/map.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/backend/handlers/map.go b/backend/handlers/map.go index 3bf14cd..faccee4 100644 --- a/backend/handlers/map.go +++ b/backend/handlers/map.go | |||
| @@ -104,7 +104,7 @@ func FetchMapSummary(c *gin.Context) { | |||
| 104 | if response.Map.IsCoop { | 104 | if response.Map.IsCoop { |
| 105 | sql = `SELECT count(*) FROM ( SELECT host_id, partner_id, score_count, score_time, | 105 | sql = `SELECT count(*) FROM ( SELECT host_id, partner_id, score_count, score_time, |
| 106 | ROW_NUMBER() OVER (PARTITION BY host_id, partner_id ORDER BY score_count, score_time) AS rn | 106 | ROW_NUMBER() OVER (PARTITION BY host_id, partner_id ORDER BY score_count, score_time) AS rn |
| 107 | FROM records_mp WHERE map_id = $1 | 107 | FROM records_mp WHERE map_id = $1 AND is_deleted = false |
| 108 | ) sub WHERE sub.rn = 1 AND score_count = $2` | 108 | ) sub WHERE sub.rn = 1 AND score_count = $2` |
| 109 | err = database.DB.QueryRow(sql, response.Map.ID, route.History.ScoreCount).Scan(&route.CompletionCount) | 109 | err = database.DB.QueryRow(sql, response.Map.ID, route.History.ScoreCount).Scan(&route.CompletionCount) |
| 110 | if err != nil { | 110 | if err != nil { |
| @@ -114,7 +114,7 @@ func FetchMapSummary(c *gin.Context) { | |||
| 114 | } else { | 114 | } else { |
| 115 | sql = `SELECT count(*) FROM ( SELECT user_id, score_count, score_time, | 115 | sql = `SELECT count(*) FROM ( SELECT user_id, score_count, score_time, |
| 116 | ROW_NUMBER() OVER (PARTITION BY user_id ORDER BY score_count, score_time) AS rn | 116 | ROW_NUMBER() OVER (PARTITION BY user_id ORDER BY score_count, score_time) AS rn |
| 117 | FROM records_sp WHERE map_id = $1 | 117 | FROM records_sp WHERE map_id = $1 AND is_deleted = false |
| 118 | ) sub WHERE rn = 1 AND score_count = $2` | 118 | ) sub WHERE rn = 1 AND score_count = $2` |
| 119 | err = database.DB.QueryRow(sql, response.Map.ID, route.History.ScoreCount).Scan(&route.CompletionCount) | 119 | err = database.DB.QueryRow(sql, response.Map.ID, route.History.ScoreCount).Scan(&route.CompletionCount) |
| 120 | if err != nil { | 120 | if err != nil { |
| @@ -204,7 +204,7 @@ func FetchMapLeaderboards(c *gin.Context) { | |||
| 204 | record_date, | 204 | record_date, |
| 205 | ROW_NUMBER() OVER (PARTITION BY host_id, partner_id ORDER BY score_count, score_time) AS rn | 205 | ROW_NUMBER() OVER (PARTITION BY host_id, partner_id ORDER BY score_count, score_time) AS rn |
| 206 | FROM records_mp | 206 | FROM records_mp |
| 207 | WHERE map_id = $1 | 207 | WHERE map_id = $1 AND is_deleted = false |
| 208 | ) sub | 208 | ) sub |
| 209 | JOIN users AS host ON sub.host_id = host.steam_id | 209 | JOIN users AS host ON sub.host_id = host.steam_id |
| 210 | JOIN users AS partner ON sub.partner_id = partner.steam_id | 210 | JOIN users AS partner ON sub.partner_id = partner.steam_id |
| @@ -255,7 +255,7 @@ func FetchMapLeaderboards(c *gin.Context) { | |||
| 255 | SELECT id, user_id, score_count, score_time, demo_id, record_date, | 255 | SELECT id, user_id, score_count, score_time, demo_id, record_date, |
| 256 | ROW_NUMBER() OVER (PARTITION BY user_id ORDER BY score_count, score_time) AS rn | 256 | ROW_NUMBER() OVER (PARTITION BY user_id ORDER BY score_count, score_time) AS rn |
| 257 | FROM records_sp | 257 | FROM records_sp |
| 258 | WHERE map_id = $1 | 258 | WHERE map_id = $1 AND is_deleted = false |
| 259 | ) sub | 259 | ) sub |
| 260 | INNER JOIN users ON user_id = users.steam_id | 260 | INNER JOIN users ON user_id = users.steam_id |
| 261 | WHERE rn = 1 | 261 | WHERE rn = 1 |