Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ $ cd cookoff-9.0-backend

### Prerequisites

1. Setup atlas
1. Setup [atlas](https://atlasgo.io/getting-started)
2. Configure env (refer .env.example)
3. Configure Makefile

Expand Down
2 changes: 1 addition & 1 deletion internal/db/db.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/db/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/db/questions.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/db/submission.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/db/submission_status.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/db/testcases.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/db/user.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/middlewares/round_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func CheckRound(next http.Handler) http.Handler {
roundVal, _ := strconv.Atoi(round)

if user.RoundQualified != int32(roundVal) {
httphelpers.WriteError(w, http.StatusForbidden, "not qualified")
httphelpers.WriteError(w, http.StatusForbidden, "round not enabled yet")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if round 2 is enabled and user was not qualified for it so their round is 1

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's "User is not qualified for this round" error for that (in preview questions and other routes.) Unless this is being used in the frontend to tell whether the user is qualified for the round, it shouldn't be an issue.

I guess a better solution would be to put up a seperate middleware to tell whether the round is enabled or not, otherwise this error is misleading.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Round being enabled was a check from the frontend this time round

that's why we only check for qualification

return
}
next.ServeHTTP(w, r)
Expand Down