dev_local
huang 6 years ago
commit e8a8df58ab

@ -1132,7 +1132,7 @@ class AccountController < ApplicationController
reward_grade(@user, @user.id, 'Phone', 500)
else
@user.update_attributes!(:mail => params[:value])
Gitlab.client.edit_user_email(@user.gid, :email => @user.mail) if @user.gid
# Gitlab.client.edit_user_email(@user.gid, :email => @user.mail) if @user.gid
reward_grade(@user, @user.id, 'Mail', 500)
end
end

@ -465,7 +465,7 @@ class ChallengesController < ApplicationController
render_404
return
else
if (@shixun.status == 0 && !User.current.manager_of_shixun?(@shixun))
if (@shixun.status == 0 && !User.current.manager_of_shixun?(@shixun)) || @shixun.status == -1
render_403
return
end

@ -18,7 +18,7 @@ class EcsController < ApplicationController
@major_count = @major_schools.count
if @major_count == 0
if !@is_school_manager && @major_count == 0
render_403
else
if params[:search].present?

@ -158,7 +158,7 @@ class ManagementsController < ApplicationController
@sub_type = 8
@g = Gitlab.client
if params[:search]
myshixun_id = Game.where(:identifier => params[:search]).pluck(:myshixun_id)
myshixun_id = Game.where("identifier = #{params[:search]} or id = #{params[:search]}").pluck(:myshixun_id)
@myshixuns = Myshixun.where(:id => myshixun_id).includes(:shixun)
else
@myshixuns = Myshixun.where("0=0").includes(:shixun)
@ -812,7 +812,7 @@ class ManagementsController < ApplicationController
format.xls{
shixun_ids = @all_discusses.pluck(:dis_id).uniq
filename = "#{Time.now.strftime("%Y%m%d")}-实训反馈.xls"
send_data(shixun_feedback_xls(shixun_ids), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
send_data(shixun_feedback_xls(shixun_ids), :type => "text/excel;charset=utf-8; header=present", :filename => filename_for_content_disposition(filename))
}
end
end

@ -1115,8 +1115,8 @@ class ShixunsController < ApplicationController
g.delete_project(@shixun.gpid) if @shixun.try(:gpid).present?
apply_record = ApplyAction.where(:container_id => @shixun.id, :container_type => "ApplyShixun")
apply_record.delete_all if apply_record
HomeworkCommonsShixuns.where(:shixun_id => @shixun).delete_all # 关联删报错,后续解决
@shixun.destroy
#HomeworkCommonsShixuns.where(:shixun_id => @shixun).delete_all # 关联删报错,后续解决
@shixun.update_attribute(:status, -1)
respond_to do |format|
if params[:come_from] == "admin"
format.html{ redirect_to shixuns_managements_path }
@ -1215,7 +1215,7 @@ class ShixunsController < ApplicationController
# Find shixun of id params[:id]
def find_shixun
@shixun = Shixun.find_by_identifier(params[:id])
render_404 if @shixun.nil?
render_404 if @shixun.nil? || @shixun.status == -1
rescue ActiveRecord::RecordNotFound
render_404
end
@ -1362,4 +1362,8 @@ class ShixunsController < ApplicationController
def validation_email
render_403 if User.current.mail.blank?
end
def validate_shixun
end
end

@ -6,32 +6,36 @@ module SubjectsHelper
end
# 实训路径详情列表,右侧状态显示栏
def shixun_show_in_subject subject_status, shixun_status
content = if subject_status < 2
case shixun_status
when 0, 1
'<span class="fr color-grey-c">暂未公开</span>'
when 2
'<span class="fr color-grey-9">已发布</span>'
when 3
'<span class="fr color-grey-9">已关闭</span>'
else
""
end
else
if shixun_status != 2
case shixun_status
when 0, 1
'<span class="fr color-grey-c">暂未公开</span>'
when 3
'<span class="fr color-grey-9">已关闭</span>'
else
""
end
else
""
end
end
def shixun_show_in_subject subject_status, shixun_status, shixun_hidden
content = if shixun_hidden
'<span class="fr color-grey-c">暂未公开</span>'
else
if subject_status < 2
case shixun_status
when 0, 1
'<span class="fr color-grey-c">暂未公开</span>'
when 2
'<span class="fr color-grey-9">已发布</span>'
when 3
'<span class="fr color-grey-9">已关闭</span>'
else
""
end
else
if shixun_status != 2
case shixun_status
when 0, 1
'<span class="fr color-grey-c">暂未公开</span>'
when 3
'<span class="fr color-grey-9">已关闭</span>'
else
""
end
else
""
end
end
end
return content.html_safe
end
@ -39,7 +43,7 @@ module SubjectsHelper
def start_shixun_in_subject subject, shixun, myshixun
is_modify = ShixunModify.where(:myshixun_id => myshixun.try(:id), :shixun_id => shixun.try(:id), :status => 1).first
content_before = ''
content = if shixun.status == 2 || User.current.manager_of_shixun?(shixun)
content = if (shixun.status == 2 && !shixun.hidden) || User.current.manager_of_shixun?(shixun)
content_before = "<a href=\"#{shixun_path(shixun)}\" class=\"mr30 color-blue_4C shixun_detail pointer fl none\" target=\"_blank\">查看详情</a>"
if User.current.try(:mail).blank?
%Q{<a class="btn_auto user_bluebg_btn fl none" onclick="sure_box_redirect_without_newtab_btn('#{security_settings_path}', '开启实训,请先绑定邮箱','绑定邮箱');" id = "shixun_operation">开始实战</a>}

@ -73,7 +73,7 @@ class Shixun < ActiveRecord::Base
end
def fork_identifier
self.fork_from.nil? ? "--" : Shixun.find(self.fork_from).try(:identifier)
self.fork_from.nil? ? "--" : Shixun.where(id: self.fork_from).first.try(:identifier)
end
def get_fork

@ -128,9 +128,9 @@ class ShixunsService
manager = current_user.manager_of_shixun?(dis, current_user)
game_url =
if manager
challenge_id = dis.challenges.where(position: d.position).pluck(:id).first
game_identifier = Game.where(user_id: current_user,
challenge_id: challenge_id).pluck(:identifier).first
position = d.position.nil? ? 1 : d.position
game_identifier = Game.find_by_sql("SELECT g.identifier FROM games g JOIN challenges c on g.challenge_id = c.id
WHERE c.shixun_id = #{dis.id} AND c.position = #{position} AND g.user_id = #{d.user_id}").first.try(:identifier)
"/tasks/#{game_identifier}"
else
""

@ -10,13 +10,12 @@
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'css/edu-common','educoder/edu-main','educoder/edu-all', 'css/edu-public', 'css/font-awesome', 'css/edu-class', 'css/magic-check'%>
<%#= javascript_heads %>
<%= javascript_include_tag "edu/application",'educoder/edu_application'%>
<%= javascript_heads %>
<%= javascript_include_tag "edu/application", 'educoder/edu_application'%>
</head>
<body onload="prettyPrint();" style="height: 100%; background: #fff;">
<body style="height: 100%; background: #fff;">
<div class="newContainer" style="width: 1000px;"> <!-- 页面全部内容 -->
<div class="clearfix" style="width: 1000px;"> <!-- 主题部分 -->
<%= render_flash_messages %>
<%= yield %>
<div class="cl"></div>
</div>

@ -38,7 +38,7 @@
<td><%= user.try(:authentication_status) %></td>
<td><%= user.try(:professional_status) %></td>
<td ><span class="edu-txt-w140 task-hide2" title="<%= user.try(:user_extensions).try(:school).try(:name) %>"><%= user.try(:user_extensions).try(:school).try(:name).blank? ? "--" : user.try(:user_extensions).try(:school) %></span></td>
<td ><span class="edu-txt-w140 task-hide2"><%= user.try(:user_extensions).department ? user.try(:user_extensions).try(:department).try(:name).to_s : '--' %></span></td>
<td ><span class="edu-txt-w140 task-hide2"><%= user.try(:user_extensions).try(:department) ? user.try(:user_extensions).try(:department).try(:name).to_s : '--' %></span></td>
<td><%= user.last_login_on.blank? ? "--" : (format_time user.last_login_on) %></td>
<td><%= identity_authentication_status(user) %></td>
<td class="homepage_teacher">

@ -93,7 +93,7 @@
<%#= render :partial => "student_work/echart_of_shixun_skills" %>
</div>
</div>-->
<% if true %>
<% unless params[:pdf] %>
<div class="bor-grey-e mt20">
<p class="pt10 pb10 pl15 pr15 clearfix bor-bottom-greyE">
<span class="fl font-bd">图形统计</span>

@ -61,7 +61,7 @@
<span class="paragraph_name <%= shixun.status < 2 && !is_shixun_manager ? "color-grey-c" : "color-grey3" %>"><span class="subject_stage_shixun_index"><%= s_index + 1 %></span>-<%= index + 1 %>&nbsp;&nbsp;<%= shixun.name %></span>
</li>
<li class="fr status_li">
<%= shixun_show_in_subject @subject.status, shixun.status %>
<%= shixun_show_in_subject @subject.status, shixun.status, shixun.hidden %>
<%= start_shixun_in_subject @subject, shixun, myshixun %>
</li>
</div>

@ -0,0 +1,14 @@
class MigrateHomeworkCommonEndTimes < ActiveRecord::Migration
def up
homework_commons = HomeworkCommon.where("id < 21549")
homework_commons.find_each do |homework|
sql = "update homework_commons set end_time = (select max(end_time) from
homework_seconds where id = #{homework.id}) where id = #{homework.id}"
ActiveRecord::Base.connection.execute(sql)
end
end
def down
end
end

@ -0,0 +1,13 @@
class MigrateHomeworkCommonEndTime2 < ActiveRecord::Migration
def up
homework_commons = HomeworkCommon.where("id >= 21549")
homework_commons.each do |homework|
if homework.publish_time.nil?
homework.update_column('end_time', nil)
end
end
end
def down
end
end

@ -0,0 +1,11 @@
class ModifyForkFromForShixuns < ActiveRecord::Migration
def up
shixuns = Shixun.where(:fork_from => 1933)
shixuns.each do |shixun|
shixun.update_attribute(:fork_from, nil)
end
end
def down
end
end

@ -277,6 +277,12 @@ class Comments extends Component {
</a>
<span className="t_area fl">{item.time}</span>
{ item.position && <span className="fl color-light-green font-14 ml15">[{item.position}]</span> }
{ item.game_url ?
<Tooltip title={ `点击查看TA的代码页面` } disableFocusListener={true}>
<a href={item.game_url} target="_blank" className="fl font-14 ml15"
style={{ color: "#4CACFF", cursor: "pointer" }}
>查看</a>
</Tooltip> : ""}
{
item.reward ?
<Tooltip title={ `已奖励金币${item.reward}` } disableFocusListener={true}>
@ -303,7 +309,7 @@ class Comments extends Component {
<div className="comment_content clearfix" id={`reply_content_${item.id}`}>
<div className="color-grey-3 break_word_comments" id={`reply_content_${item.id}`}>
{ item.hidden && item.admin === false && item.manager === false
{ item.hidden && item.admin === false && (item.manager === false || item.manager == undefined)
? <p className="color-orange font-16">违规评论已被屏蔽</p>
: <div dangerouslySetInnerHTML={{__html: _content}}></div>
}

Loading…
Cancel
Save