diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 8f3a2b53..0b4a5841 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -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 diff --git a/app/controllers/ecloud_controller.rb b/app/controllers/ecloud_controller.rb index 33787a31..3e02c579 100644 --- a/app/controllers/ecloud_controller.rb +++ b/app/controllers/ecloud_controller.rb @@ -104,6 +104,8 @@ class EcloudController < ApplicationController des_services = params['services'].select{|s| s['opttype'] == 1} if des_services.present? des_services.each do |ds| + + logger.info("666666#{ecloud.try(:id)}, 55555555#{ds['code']}") esd = EcloudService.where(ecloud_id: ecloud.try(:id), code: ds['code']).first esd.update_attributes!(opttype: ds['opttype'], begintime: ds['begintime'], endtime: ds['endtime']) end @@ -143,10 +145,10 @@ class EcloudController < ApplicationController # end render :json => {result: true, errmsg: ""} - rescue Exception => e - logger.error(e.message) - render :json => {code: 500, msg: "#{e.message}"} - raise ActiveRecord::Rollback + # rescue Exception => e + # logger.error(e.message) + # render :json => {code: 500, msg: "#{e.message}"} + # raise ActiveRecord::Rollback end end end diff --git a/app/helpers/subjects_helper.rb b/app/helpers/subjects_helper.rb index c81d560b..0a8d659f 100644 --- a/app/helpers/subjects_helper.rb +++ b/app/helpers/subjects_helper.rb @@ -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 - '暂未公开' - when 2 - '已发布' - when 3 - '已关闭' - else - "" - end - else - if shixun_status != 2 - case shixun_status - when 0, 1 - '暂未公开' - when 3 - '已关闭' - else - "" - end - else - "" - end - end + def shixun_show_in_subject subject_status, shixun_status, shixun_hidden + content = if shixun_hidden + '暂未公开' + else + if subject_status < 2 + case shixun_status + when 0, 1 + '暂未公开' + when 2 + '已发布' + when 3 + '已关闭' + else + "" + end + else + if shixun_status != 2 + case shixun_status + when 0, 1 + '暂未公开' + when 3 + '已关闭' + 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 = "查看详情" if User.current.try(:mail).blank? %Q{开始实战} diff --git a/app/views/subjects/_paths_list.html.erb b/app/views/subjects/_paths_list.html.erb index 615eaa18..fdd5e262 100644 --- a/app/views/subjects/_paths_list.html.erb +++ b/app/views/subjects/_paths_list.html.erb @@ -61,7 +61,7 @@ "><%= s_index + 1 %>-<%= index + 1 %>  <%= shixun.name %>
  • - <%= 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 %>
  • diff --git a/db/migrate/20190329070441_migrate_homework_common_end_times.rb b/db/migrate/20190329070441_migrate_homework_common_end_times.rb new file mode 100644 index 00000000..0fa7b6cb --- /dev/null +++ b/db/migrate/20190329070441_migrate_homework_common_end_times.rb @@ -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 diff --git a/db/migrate/20190329080718_migrate_homework_common_end_time2.rb b/db/migrate/20190329080718_migrate_homework_common_end_time2.rb new file mode 100644 index 00000000..65d4670a --- /dev/null +++ b/db/migrate/20190329080718_migrate_homework_common_end_time2.rb @@ -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