aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/db/query.sql.go
diff options
context:
space:
mode:
Diffstat (limited to 'backend/db/query.sql.go')
-rw-r--r--backend/db/query.sql.go17
1 files changed, 13 insertions, 4 deletions
diff --git a/backend/db/query.sql.go b/backend/db/query.sql.go
index 23be719..cdf1cc9 100644
--- a/backend/db/query.sql.go
+++ b/backend/db/query.sql.go
@@ -383,21 +383,26 @@ SELECT
u.label AS user_label,
s1.code_size AS code_size_1,
s2.code_size AS code_size_2,
- (s1.code_size + s2.code_size) AS total_code_size,
+ s3.code_size AS code_size_3,
+ (COALESCE(s1.code_size, 0) + COALESCE(s2.code_size, 0) + COALESCE(s3.code_size, 0)) AS total_code_size,
s1.created_at AS submitted_at_1,
- s2.created_at AS submitted_at_2
+ s2.created_at AS submitted_at_2,
+ s3.created_at AS submitted_at_3
FROM game_states gs1
JOIN submissions s1 ON gs1.best_score_submission_id = s1.submission_id
JOIN game_states gs2 ON gs1.user_id = gs2.user_id
JOIN submissions s2 ON gs2.best_score_submission_id = s2.submission_id
+JOIN game_states gs3 ON gs1.user_id = gs3.user_id
+JOIN submissions s3 ON gs3.best_score_submission_id = s3.submission_id
JOIN users u ON gs1.user_id = u.user_id
-WHERE gs1.game_id = $1 AND gs2.game_id = $2
+WHERE gs1.game_id = $1 AND gs2.game_id = $2 AND gs3.game_id = $3
ORDER BY total_code_size ASC
`
type GetQualifyingRankingParams struct {
GameID int32
GameID_2 int32
+ GameID_3 int32
}
type GetQualifyingRankingRow struct {
@@ -405,13 +410,15 @@ type GetQualifyingRankingRow struct {
UserLabel *string
CodeSize1 int32
CodeSize2 int32
+ CodeSize3 int32
TotalCodeSize int32
SubmittedAt1 pgtype.Timestamp
SubmittedAt2 pgtype.Timestamp
+ SubmittedAt3 pgtype.Timestamp
}
func (q *Queries) GetQualifyingRanking(ctx context.Context, arg GetQualifyingRankingParams) ([]GetQualifyingRankingRow, error) {
- rows, err := q.db.Query(ctx, getQualifyingRanking, arg.GameID, arg.GameID_2)
+ rows, err := q.db.Query(ctx, getQualifyingRanking, arg.GameID, arg.GameID_2, arg.GameID_3)
if err != nil {
return nil, err
}
@@ -424,9 +431,11 @@ func (q *Queries) GetQualifyingRanking(ctx context.Context, arg GetQualifyingRan
&i.UserLabel,
&i.CodeSize1,
&i.CodeSize2,
+ &i.CodeSize3,
&i.TotalCodeSize,
&i.SubmittedAt1,
&i.SubmittedAt2,
+ &i.SubmittedAt3,
); err != nil {
return nil, err
}