Merge branch 'cxt_course' into develop

This commit is contained in:
cxt 2016-12-27 16:38:26 +08:00
commit b10720520b
1 changed files with 3 additions and 1 deletions

View File

@ -4067,8 +4067,10 @@ class UsersController < ApplicationController
@contest = Contest.find params[:contest] @contest = Contest.find params[:contest]
member = ContestMember.where("user_id = #{@user.id} and contest_id = #{@contest.id}") member = ContestMember.where("user_id = #{@user.id} and contest_id = #{@contest.id}")
end end
unless member.empty? if !member.empty? && params[:contest]
member.first.update_attribute(:is_collect, member.first.is_collect == false ? 1 : 0) 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 end
if @project 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) @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)