Skip to content

Commit f9dc17f

Browse files
authored
fix duplicates being shown in the error message for user's upcoming competitions
1 parent d5cd3c7 commit f9dc17f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/controllers/api/v0/user_roles_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def create
7676
user = User.find(user_id)
7777
ban_reason = params[:banReason]
7878
scope = params[:scope]
79-
upcoming_comps_for_user = user.competitions_registered_for.not_over.joins(:registrations).where.not(registrations: { competing_status: ['rejected', 'cancelled'] })
79+
upcoming_comps_for_user = user.competitions_registered_for.not_over.joins(:registrations).where.not(registrations: { competing_status: ['rejected', 'cancelled'] }).distinct
8080
upcoming_comps_for_user = upcoming_comps_for_user.between_dates(Date.today, end_date) if end_date.present?
8181
unless upcoming_comps_for_user.empty?
8282
return render status: :unprocessable_entity, json: {

0 commit comments

Comments
 (0)