diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 5933f2e9c..5b94dd75c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -4067,8 +4067,10 @@ class UsersController < ApplicationController @contest = Contest.find params[:contest] member = ContestMember.where("user_id = #{@user.id} and contest_id = #{@contest.id}") end - unless member.empty? + if !member.empty? && params[:contest] member.first.update_attribute(:is_collect, member.first.is_collect == false ? 1 : 0) + elsif !member.empty? + member.first.update_attribute(:is_collect, member.first.is_collect == 0 ? 1 : 0) end if @project @projects = @user.favorite_projects.visible.select("projects.*, (SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10)