课程列表的班级收藏
This commit is contained in:
parent
f1a4cac61c
commit
2b2498d66a
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue