From: Brendan Hansen Date: Tue, 24 Mar 2020 20:39:50 +0000 (-0500) Subject: Fixed bug where user can join multiple times X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=07a61d3c7d2122926950697771293f9190945075;p=codebox.git Fixed bug where user can join multiple times --- diff --git a/codebox/controllers/account/join_competition.moon b/codebox/controllers/account/join_competition.moon index 54c3ad9..aae62ed 100644 --- a/codebox/controllers/account/join_competition.moon +++ b/codebox/controllers/account/join_competition.moon @@ -14,6 +14,10 @@ make_controller } @competition = Competitions\find short_name: @params.competition_name + + if CompetitionUsers\find user_id: @user.id, competition_id: @competition.id + return redirect_to: @url_for 'leaderboard', { competition_name: @competition.short_name } + CompetitionUsers\create user_id: @user.id competition_id: @competition.id