竞赛“提交”的相关bug修复

This commit is contained in:
cxt 2016-12-30 20:30:45 +08:00
parent 0f4e3f0189
commit a5e6ed0d39
4 changed files with 14 additions and 10 deletions

View File

@ -15,6 +15,7 @@ class ContestantWorksController < ApplicationController
def new
#更新消息
if @contestwork.work_status == 1
noEvaluation = @contestwork.contest_messages.where("user_id =? and viewed =?", User.current.id, 0)
noEvaluation.update_all(:viewed => true)
@ -23,6 +24,9 @@ class ContestantWorksController < ApplicationController
respond_to do |format|
format.html{ render :layout => "base_contests"}
end
else
render_403
end
end
def index

View File

@ -175,11 +175,11 @@ class ContestsController < ApplicationController
end
case params[:agree]
when 'Y'
if ContestMember.where(:user_id => apply_user.id).first.nil?
if ContestMember.where(:user_id => apply_user.id, :contest_id => applied_contest.contest_id).first.nil?
member = ContestMember.new(:user_id => apply_user.id)
Contest.find(applied_contest.contest_id).contest_members << member
else
member = ContestMember.where(:user_id => apply_user.id).first
member = ContestMember.where(:user_id => apply_user.id, :contest_id => applied_contest.contest_id).first
end
contest_member_roles = member.contest_member_roles

View File

@ -70,7 +70,7 @@ class WorksController < ApplicationController
homework.save_attachments(params[:attachments])
render_attachment_warning_if_needed(homework)
homework.work_status = homework.publish_time > Date.today ? 0 : 1
homework.work_status = homework.publish_time > Date.today ? 0 : (homework.end_time < Date.today ? 2 : 1)
work_detail_manual = WorkDetailManual.new

View File

@ -102,7 +102,7 @@
<span class="homepageNewsType fl">发布了竞赛题:</span>
</li>
<li class="messageInformationContents">
<% if User.current.contestant_of_contest?(ma.contest_message.contest) && cur_user_works_for_work(ma.contest_message).nil? %>
<% if User.current.contestant_of_contest?(ma.contest_message.contest) && cur_user_works_for_work(ma.contest_message).nil? && ma.contest_message.work_status == 1 %>
<%= link_to ma.contest_message.name, new_contestant_work_path(:work => ma.contest_message.id),
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:target => '_blank',