dev_local
jingquan huang 6 years ago
commit 5a3447b5cf

@ -1,4 +1,4 @@
source 'http://gems.ruby-china.com'
source 'https://gems.ruby-china.com'
unless RUBY_PLATFORM =~ /w32/
# unix-like only

@ -891,7 +891,7 @@ class AccountController < ApplicationController
@user = User.current
@se = @user.extensions
# 已授权的用户修改单位名称,需要重新授权
if @se.school_id != params[:occupation].to_i && @user.certification == 1
if (@se.school_id != params[:occupation].to_i || @se.identity != params[:identity].to_i) && @user.certification == 1
@user.certification = 0
apply_user = ApplyAction.where(:user_id => @user.id, :container_type => "TrialAuthorization")
apply_user.update_all(:status => 2) unless apply_user.blank?
@ -1038,7 +1038,7 @@ class AccountController < ApplicationController
apply_action = ApplyAction.where(:user_id => User.current.id, :container_type => "TrialAuthorization", :status => 0).first
school_ids = School.where(:auto_users_trial => 1).map(&:id)
user_ex = User.current.user_extensions
if (user_ex.identity == 0 || (user_ex.identity == 1 && user_ex.student_id.present?)) && !user_ex.school.nil? && school_ids.include?(user_ex.school_id)
if user_ex.identity == 1 && user_ex.student_id.present? && !user_ex.school.nil? && school_ids.include?(user_ex.school_id)
User.current.update_attributes(:certification => 1)
logger.warn("apply_trail #######{User.current.login} ****#{User.current.user_extensions.school_id}")
@tip = "申请已提交我们将在1分钟内完成审核"

@ -65,16 +65,73 @@ class ApplicationController < ActionController::Base
include Redmine::MenuManager::MenuController
helper Redmine::MenuManager::MenuHelper
def ecloud_auth ucloud_user_id
euser = EcloudUser.where("id =? and opttype not in(3, 5)", ucloud_user_id).first
# 云启训练场EduCoder个人版 产品编码appId 9200108
# 产品名称 计费类型 套餐编码
# 云启训练场EduCoder个人版 固定包月 9200108001
# 固定包月 9200108002
# 固定包月 9200108003
# ---------------------------------------------------
# 产品名称 计费类型 套餐编码
# 云启训练场EduCoder院校版 包月+按license 9200109001
# 包月+按license 9200109002
# 云启训练场EduCoder院校版 产品编码appId 9200109
# 如果不是Ecloud过来的用户则不改变用户的使用状态及权限按现有模式即可
def ecloud_auth
euser = EcloudUser.where("userid =? and opttype not in(3, 5)", User.current.id).first
if euser.present? # 开通过业务
# ni
# 获取用户的套餐信息
e_services = euser.ecloud_services.where("opttype != 1").order("ecloud_services.code desc")
# 如果用户开通过服务
if e_services.present?
if e_services.count > 1 # 说明有重复开通过业务
# 开通多业务的话以最大的套餐排序如果最大套餐还可以用则直接返回true如果最大套餐不能用则轮询返回直到找到可用的套餐
e_services.each do |e_service|
# 使用期限内套餐才有效
ecloud_services_auth(e_service.code, e_service.begintime, e_service.endtime)
end
else
# 先看套餐,再看时间区间
e_service = e_services.first
ecloud_services_auth(e_service.code, e_service.begintime, e_service.endtime)
end
else
false # 没开通过服务,或者服务被禁用则不允许访问
end
end
end
# 根据业务确定权限
def ecloud_services_auth code, begintime, endtime
# 如果当前实训不在实训课堂等级体系中,则不允许访问
subject_id = @shixun.stage_shixuns.map(&:subject_id)
if subject_id.blank?
render_403
end
subject_level = Subject.find(subject_id).subject_level_system.try(:level)
# 当前时间转毫秒
current_time = DateTime.now.strftime('%Q').to_i
if current_time - begintime > 0 && endtime - current_time > 0
case code
when "9200108001"
subject_level.to_i == 1 ? true : false
when "9200108002"
subject_level.to_i == 2 ? true : false
when "9200108003"
subject_level.to_i == 3 ? true : false
when "9200109001" # 企业用户
subject_level.to_i < 3 ? true : false
when "9200109002" # 企业用户
subject_level.to_i <= 3 ? true : false
end
else
false
end
end
def ec_public_auth major_school
unless User.current.admin? || major_school.template_major || major_school.school.users.where(:id => User.current.id).count > 0 ||
major_school.ec_major_school_users.where(:user_id => User.current.id).count > 0 ||

@ -13,7 +13,7 @@ class ChallengesController < ApplicationController
skip_before_filter :verify_authenticity_token, :only => [:create_choose_question, :update_choose_question]
#before_filter :find_shixun_language, :only => [:show, :new, :edit]
before_filter :base_index, :only => [:index, :index_down, :index_up, :destroy]
before_filter :view_allow, :only => [:index, :show]
before_filter :view_allow, :only => [:show]
include ApplicationHelper

@ -1190,9 +1190,16 @@ class CoursesController < ApplicationController
@all_members = searchmember_by_name(student_homework_score(0, 0, 10,"desc"), q)
end
@homeworks = @course.homework_commons.where("publish_time <= '#{Time.now}'").order("publish_time asc")
@exercises = @course.exercises.where("publish_time <= '#{Time.now}'").order("publish_time asc")
@tasks = @course.graduation_tasks.where("publish_time <= '#{Time.now}'").order("publish_time asc")
@homeworks = @course.homework_commons.where("publish_time <= '#{Time.now}'").order("publish_time asc, created_at asc")
@exercises = @course.exercises.where("publish_time <= '#{Time.now}'").order("publish_time asc, created_at asc")
@tasks = @course.graduation_tasks.where("publish_time <= '#{Time.now}'").order("publish_time asc, created_at asc")
@homeworks.where(:homework_type => 4).each do |homework|
items = homework.student_works.where("work_status != 0")
if items.count == 0 && homework.publish_time < Time.now && !@course.is_end
update_shixun_work_status homework
end
end
respond_to do |format|
format.xls {
@ -2390,8 +2397,8 @@ class CoursesController < ApplicationController
sheet1[4,3] = "学号"
sheet1[4,4] = "分班"
current_col = 4
for i in 0 ... homeworks.where(:homework_type => 4).count
sheet1[4,current_col+=1] = "实训作业第"+(i+1).to_s+""
homeworks.where(:homework_type => 4).each do |homework|
sheet1[4,current_col+=1] = "#{homework.name}"
end
for i in 0 ... homeworks.where(:homework_type => 1).count
sheet1[4,current_col+=1] = "普通作业第"+(i+1).to_s+""
@ -2425,63 +2432,63 @@ class CoursesController < ApplicationController
sheet1[count_row,column+=1] = member.course_group_id == 0 ? "暂无" : member.course_group.name
# current_col = 5
shixun_score = 0
homeworks.where(:homework_type => 4).each do |homework|
homeworks.where(:homework_type => 4).includes(:student_works).each do |homework|
student_works = homework.student_works.where("user_id = #{member.user.id}")
if student_works.empty?
sheet1[count_row,column+=1] = 0
else
work_score = student_works.first.work_score.nil? ? 0 : student_works.first.work_score
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(2)
shixun_score += work_score < 0 ? 0 : work_score.round(2)
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
shixun_score += work_score < 0 ? 0 : work_score.round(1)
end
# current_col += 1
end
common_score = 0
homeworks.where(:homework_type => 1).each do |homework|
homeworks.where(:homework_type => 1).includes(:student_works).each do |homework|
student_works = homework.student_works.where("user_id = #{member.user.id}")
if student_works.empty?
sheet1[count_row,column+=1] = 0
else
work_score = student_works.first.work_score.nil? ? 0 : student_works.first.work_score
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(2)
common_score += work_score < 0 ? 0 : work_score.round(2)
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
common_score += work_score < 0 ? 0 : work_score.round(1)
end
# current_col += 1
end
group_score = 0
homeworks.where(:homework_type => 3).each do |homework|
homeworks.where(:homework_type => 3).includes(:student_works).each do |homework|
student_works = homework.student_works.where("user_id = #{member.user.id}")
if student_works.empty?
sheet1[count_row,column+=1] = 0
else
work_score = student_works.first.work_score.nil? ? 0 : student_works.first.work_score
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(2)
group_score += work_score < 0 ? 0 : work_score.round(2)
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
group_score += work_score < 0 ? 0 : work_score.round(1)
end
# current_col += 1
end
exercise_score = 0
exercises.each do |exercise|
exercises.includes(:exercise_users).each do |exercise|
exercise_user = exercise.exercise_users.where("user_id = #{member.user.id}")
if exercise_user.empty?
sheet1[count_row,column+=1] = 0
else
work_score = exercise_user.first.score.nil? ? 0 : exercise_user.first.score
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(2)
exercise_score += work_score < 0 ? 0 : work_score.round(2)
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
exercise_score += work_score < 0 ? 0 : work_score.round(1)
end
# current_col += 1
end
graduation_score = 0
tasks.each do |task|
tasks.includes(:graduation_works).each do |task|
graduation_works = task.graduation_works.where("user_id = #{member.user.id}")
if graduation_works.empty?
sheet1[count_row,column+=1] = 0
else
work_score = graduation_works.first.work_score.nil? ? 0 : graduation_works.first.work_score
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(2)
graduation_score += work_score < 0 ? 0 : work_score.round(2)
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
graduation_score += work_score < 0 ? 0 : work_score.round(1)
end
# current_col += 1
end
@ -2494,7 +2501,7 @@ class CoursesController < ApplicationController
if tasks.count > 0
sheet1[count_row,column+=1] = graduation_score
end
sheet1[count_row,column+=1] = sum.round(2)
sheet1[count_row,column+=1] = sum.round(1)
count_row += 1
end
@ -2550,8 +2557,8 @@ class CoursesController < ApplicationController
count_row += 1
end
homeworks.where(:homework_type => 4).each_with_index do |home, i|
sheet = book.create_worksheet :name => "实训作业第#{i+1}"
homeworks.where(:homework_type => 4).includes(:student_works).each_with_index do |home, i|
sheet = book.create_worksheet :name => "#{home.name}"
sheet[0,0] = "课程编号"
sheet[0,1] = course.id
sheet[1,0] = "课程名称"
@ -2567,6 +2574,10 @@ class CoursesController < ApplicationController
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_des),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
count_row = 5
items = home.student_works.where("work_status != 0").order("work_score desc")
if items.count == 0 && home.publish_time < Time.now && !course.is_end
update_shixun_work_status home
items = StudentWork.where("work_status != 0 and homework_common_id = #{home.id}").order("work_score desc")
end
items.each_with_index do |stu, j|
sheet[count_row,0]= j + 1
sheet[count_row,1] = stu.user.show_real_name
@ -2574,13 +2585,13 @@ class CoursesController < ApplicationController
sheet[count_row,3] = stu.user.user_extensions.student_id
sheet[count_row,4] = strip_html stu.description
sheet[count_row,5] = stu.late_penalty
sheet[count_row,6] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
sheet[count_row,6] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
sheet[count_row,7] = format_time(stu.commit_time)
count_row += 1
end
end
homeworks.where(:homework_type => 1).each_with_index do |home, i|
homeworks.where(:homework_type => 1).includes(:student_works).each_with_index do |home, i|
sheet = book.create_worksheet :name => "普通作业第#{i+1}"
sheet[0,0] = "课程编号"
sheet[0,1] = course.id
@ -2609,17 +2620,17 @@ class CoursesController < ApplicationController
sheet[count_row,2] = stu.user.login
sheet[count_row,3] = stu.user.user_extensions.student_id
sheet[count_row,4] = strip_html stu.description
sheet[count_row,5] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(2)
sheet[count_row,6] = stu.teaching_asistant_score.nil? ? l(:label_without_score) : stu.teaching_asistant_score.round(2)
sheet[count_row,5] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(1)
sheet[count_row,6] = stu.teaching_asistant_score.nil? ? l(:label_without_score) : stu.teaching_asistant_score.round(1)
if home.anonymous_comment ==0
sheet[count_row,7] = stu.student_score.nil? ? l(:label_without_score) : stu.student_score.round(2)
sheet[count_row,7] = stu.student_score.nil? ? l(:label_without_score) : stu.student_score.round(1)
sheet[count_row,8] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.absence_penalty
sheet[count_row,9] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
sheet[count_row,10] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
sheet[count_row,10] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
sheet[count_row,11] = format_time(stu.commit_time)
else
sheet[count_row,7] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
sheet[count_row,8] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
sheet[count_row,8] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
sheet[count_row,9] = format_time(stu.commit_time)
end
count_row += 1
@ -2627,7 +2638,7 @@ class CoursesController < ApplicationController
end
homeworks.where(:homework_type => 3).each_with_index do |home, i|
homeworks.where(:homework_type => 3).includes(:student_works).each_with_index do |home, i|
sheet = book.create_worksheet :name => "分组作业第#{i+1}"
sheet[0,0] = "课程编号"
sheet[0,1] = course.id
@ -2658,17 +2669,17 @@ class CoursesController < ApplicationController
sheet[count_row,3] = stu.user.user_extensions.student_id
sheet[count_row,4] = get_group_member_names home.student_works.where(:group_id => stu.group_id).pluck(:user_id)
sheet[count_row,5] = strip_html stu.description
sheet[count_row,6] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(2)
sheet[count_row,7] = stu.teaching_asistant_score.nil? ? l(:label_without_score) : stu.teaching_asistant_score.round(2)
sheet[count_row,6] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(1)
sheet[count_row,7] = stu.teaching_asistant_score.nil? ? l(:label_without_score) : stu.teaching_asistant_score.round(1)
if home.anonymous_comment ==0
sheet[count_row,8] = stu.student_score.nil? ? l(:label_without_score) : stu.student_score.round(2)
sheet[count_row,8] = stu.student_score.nil? ? l(:label_without_score) : stu.student_score.round(1)
sheet[count_row,9] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.absence_penalty
sheet[count_row,10] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
sheet[count_row,11] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
sheet[count_row,11] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
sheet[count_row,12] = format_time(stu.commit_time)
else
sheet[count_row,8] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
sheet[count_row,9] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
sheet[count_row,9] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
sheet[count_row,10] = format_time(stu.commit_time)
end
count_row += 1
@ -2700,7 +2711,7 @@ class CoursesController < ApplicationController
sheet[count_row,3] = stu.user.user_extensions.student_id
sheet[count_row,4] = stu.objective_score == -1 ? "0.0" : format("%.1f",stu.objective_score)
sheet[count_row,5] = stu.subjective_score == -1 ? "0.0" : format("%.1f",stu.subjective_score)
sheet[count_row,6] = stu.score.nil? ? '--' : stu.score.round(2)
sheet[count_row,6] = stu.score.nil? ? '--' : stu.score.round(1)
sheet[count_row,7] = stu.commit_status == 0 ? l(:excel_no_answer) : format_time(stu.start_at)
count_row += 1
end
@ -2741,12 +2752,12 @@ class CoursesController < ApplicationController
sheet[count_row,column+=1] = get_group_member_names task.graduation_works.where(:group_id => stu.group_id).pluck(:user_id)
end
sheet[count_row,column+=1] = strip_html stu.description
sheet[count_row,column+=1] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(2)
sheet[count_row,column+=1] = stu.teacher_score.nil? ? l(:label_without_score) : stu.teacher_score.round(1)
if task.cross_comment
sheet[count_row,column+=1] = stu.cross_score.nil? ? l(:label_without_score) : stu.cross_score.round(2)
sheet[count_row,column+=1] = stu.cross_score.nil? ? l(:label_without_score) : stu.cross_score.round(1)
end
sheet[count_row,column+=1] = stu.late_penalty
sheet[count_row,column+=1] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
sheet[count_row,column+=1] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
sheet[count_row,column+=1] = format_time(stu.commit_time)
count_row += 1
end

@ -1,10 +1,10 @@
#encoding: utf-8
class EcCoursesController < ApplicationController
layout 'base_ec'
before_filter :find_ec_course, :except => [:create, :get_calculation_data, :sync_all_course_data]
before_filter :find_ec_course, :except => [:create, :get_calculation_data, :sync_all_course_data, :search_courses]
before_filter :find_year, :only => [:create, :get_calculation_data]
before_filter :require_login
before_filter :ec_auth, :except => [:sync_all_course_data]
before_filter :require_login, :except => [:search_courses, :correlation_course]
before_filter :ec_auth, :except => [:sync_all_course_data, :search_courses, :correlation_course]
skip_before_filter :verify_authenticity_token, :only => [:crud_targets, :crud_score_level, :sync_all_course_data, :search_courses,
:correlation_course, :delete_course]
@ -349,11 +349,11 @@ class EcCoursesController < ApplicationController
if user.try(:admin?)
courses = Course.where(:is_delete => 0)
else
course_ids = Member.where("user_id = #{params[:user_id]} and course_id != -1").pluck(:course_id)
course_ids = Member.where("user_id = #{user.try(:id)} and course_id != -1").pluck(:course_id)
courses = Course.where(:is_delete => 0, :id => course_ids)
end
if params[:search] && params[:search].strip != ""
courses = courses.where("name like '%#{params[:search].strip}%'").reorder("created_at desc")
courses = courses.where("name like ?", "%#{params[:search].strip}%").reorder("created_at desc")
else
courses = courses.reorder("created_at desc")
end
@ -696,15 +696,16 @@ class EcCoursesController < ApplicationController
# 毕业要求指标点达成评价
total_rate = []
total_arry = EcCourseStudentScore.find_by_sql("SELECT avg(score) as averge_score, ec_target_position as position,
ect.weigths FROM ec_student_score_targets esst, ec_course_targets ect
where esst.ec_course_target_id=ect.id group by ec_course_target_id")
ect.weigths FROM ec_student_score_targets esst, ec_course_targets ect where
esst.ec_course_target_id=ect.id and ect.ec_course_id = #{course_id}
group by ec_course_target_id")
all_score = 0
total_arry.try(:each) do |ta|
total_rate << {:position => ta.position, :score => ta.averge_score.round(1), :rate => ta.weigths}
total_rate << {:position => ta.position, :score => ta.averge_score.round(2), :rate => ta.weigths}
logger.info("##############total_rate: #{total_rate.to_json}")
all_score += ta.averge_score * ta.weigths
end
total_rate << {:total_score => (all_score).round(1)}
total_rate << {:total_score => (all_score).round(2)}
ecg_targets = EcGraduationSubitemCourseTarget.where(:ec_course_target_id => @ec_course.ec_course_targets)
ecg_targets.chunk{|c| c.ec_graduation_subitem_id}.try(:each) do |key, egs_t|
@ -724,8 +725,12 @@ class EcCoursesController < ApplicationController
va = total_rate.select{|tra| tra[:position] == po}.first
reach_real_target += va[:score] * va[:rate] if va.present?
end
Rails.logger.info("######round11111111#{(target_total_rates == 0 ? 0 : (reach_real_target * weight)/(target_total_rates.round(3)*100))}")
reach_real_target = target_total_rates == 0 ? 0 : (reach_real_target * weight)/(target_total_rates*100)
Rails.logger.info("######round2222222#{reach_real_target}")
if ec_course_support.present?
logger.info("----------ec_course_support: #{ec_course_support.id}")
egrc = ec_course_support.ec_graduation_requirement_calculation

@ -31,12 +31,10 @@ class EcYearsController < ApplicationController
end
@status = 1
end
@major_manager = User.current.admin? ||
@major_school.school.ec_school_users.pluck(:user_id).include?(User.current.id) ||
@major_school.ec_major_school_users.pluck(:user_id).include?(User.current.id)
@major_manager = true
@btn_text = @major_school.template_major && User.current.admin? ? "立即配置" :
(!@major_school.template_major && @major_manager ? "立即配置" : "查看")
@years = @major_school.ec_years
@years = EcYear.where(:ec_major_school_id => @major_school.id)
@years = paginateHelper @years, 10
respond_to do |format|
format.js

@ -17,8 +17,8 @@ require 'digest'
class EcloudController < ApplicationController
skip_before_filter :verify_authenticity_token
# before_filter :check_sign, only: [:ps_new, :ps_update, :bs_new, :bs_update]
before_filter :save_para
before_filter :check_sign, only: [:ps_new, :ps_update, :bs_new, :bs_update]
before_filter :user_setup
# before_filter :require_login, only: [:authorize]
@ -45,7 +45,6 @@ class EcloudController < ApplicationController
SERVER_URL = "https://221.176.53.130:44390/services/"
## 签名
def sign(timestamp)
Digest::MD5.hexdigest("client_id=#{CLIENT_ID}client_key=#{CLIENT_SECRET}timestamp=#{timestamp}").upcase

@ -791,7 +791,14 @@ class ManagementsController < ApplicationController
def shixun_feedback_message
@menu_type = 8
@sub_type = 2
@search = params[:search]
if @search.present?
shixun_ids = Shixun.where("name like ?", "%#{params[:search]}%").pluck(:id)
@discusses = Discuss.where(:dis_type => "Shixun", :dis_id => shixun_ids).reorder("created_at desc")
else
@discusses = Discuss.where(:dis_type => "Shixun").reorder("created_at desc")
end
@all_discusses = @discusses
@discusses_count = @discusses.count
@limit = 20
@is_remote = true
@ -802,6 +809,11 @@ class ManagementsController < ApplicationController
respond_to do |format|
format.js
format.html
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))
}
end
end
@ -1356,6 +1368,7 @@ end
after_dep = Department.where(:school_id => params[:school_id], :name => department.name).first
if after_dep
UserExtensions.where(:school_id => params[:applied_id], :department_id => department.id).update_all(:department_id => after_dep.id)
department.apply_add_departments.destroy_all
department.destroy
else
department.apply_add_departments.update_all(:school_id => params[:school_id])
@ -2104,16 +2117,24 @@ end
condition = (params[:research_condition].nil? || params[:research_condition] == "name") ? "concat(lastname, firstname)" : params[:research_condition]
if 0 == status
if params[:research_condition] == "phone" && params[:research_contents].blank?
@users = User.order("#{@order_key} #{@us_order}")
@users = User.where(nil)
else
@users = User.where("#{condition} like '%#{params[:research_contents]}%'").order("#{@order_key} #{@us_order}")
@users = User.where("#{condition} like '%#{params[:research_contents]}%'")
end
else
if params[:research_condition] == "phone" && params[:research_contents].blank?
@users = User.where(:status => status).order("#{@order_key} #{@us_order}")
@users = User.where(:status => status)
else
@users = User.where("status = #{status} and #{condition} like '%#{params[:research_contents]}%'").order("#{@order_key} #{@us_order}")
@users = User.where("status = #{status} and #{condition} like '%#{params[:research_contents]}%'")
end
end
if params[:identity] && params[:identity].to_i != -1
@users = @users.includes(:user_extensions).where("user_extensions.identity = ?", params[:identity].to_i)
end
if params[:auto_school] && params[:auto_school].to_i != 0
@users = @users.includes(:user_extensions => [:school]).where("schools.auto_users_trial = ?", params[:auto_school].to_i == 1 ? 1 : 0)
end
if params[:school] && params[:school] != ''
@ -2121,8 +2142,11 @@ end
school = School.where("name like '%#{school_name}%'")
school_id = school.map(&:id)
user_id = UserExtensions.where(:school_id => school_id).map(&:user_id)
@users = @users.where(:id => user_id).order("#{@order_key} #{@us_order}")
@users = @users.where(:id => user_id)
end
@users = @users.order("#{@order_key} #{@us_order}")
@page = (params['page'] || 1).to_i
@users_count = @users.count
@limit = 20
@ -3183,28 +3207,49 @@ end
def trial_authorization
@menu_type =10
@sub_type = 2
search = params[:search]
name_search = params[:search]
@status = trial_authorization_status(params[:status])
# @status = (params[:status].blank? || params[:status] == "0") ? 0 : [1,2]
if search.blank?
@authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => @status).includes(:user)
else
user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{search}%'")
@authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => @status, :user_id => user_id).includes(:user)
user_id = []
search = false
@authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => @status)
unless name_search.blank?
new_user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{name_search}%'").map(&:id)
user_id = user_id.size == 0 ? new_user_id : user_id & new_user_id
search = true
end
if params[:sname] && params[:sname] != ''
if params[:sname] && params[:sname].strip != ''
school_id = School.where("name like '%#{params[:sname]}%'")
user_id = UserExtensions.where(:school_id => school_id).map(&:user_id)
@authorizations = @authorizations.where(:user_id => user_id).order("updated_at desc")
new_user_id = UserExtensions.where(:school_id => school_id).map(&:user_id)
user_id = user_id.size == 0 ? new_user_id : user_id & new_user_id
search = true
end
if params[:identity] && params[:identity].to_i != -1
new_user_id = UserExtensions.where(:identity => params[:identity].to_i).map(&:user_id)
user_id = user_id.size == 0 ? new_user_id : user_id & new_user_id
search = true
end
if params[:auto_school] && params[:auto_school].to_i != 0
school_id = School.where(auto_users_trial: params[:auto_school].to_i == 1 ? 1 : 0)
new_user_id = UserExtensions.where(:school_id => school_id).map(&:user_id)
user_id = user_id.size == 0 ? new_user_id : user_id & new_user_id
search = true
end
@authorizations = user_id.size == 0 && !search ? @authorizations.order("updated_at desc") : @authorizations.where(:user_id => user_id.uniq).order("updated_at desc")
@autu_count = @authorizations.count
@limit = 15
@is_remote = true
@autu_pages = Paginator.new @autu_count, @limit, params['page'] || 1
@offset ||= @autu_pages.offset
@authorizations = paginateHelper @authorizations, @limit
@authorizations = @authorizations.includes(:user)
respond_to do |format|
format.js
format.html
@ -4013,6 +4058,41 @@ end
return sheet.rows
end
def shixun_feedback_xls shixun_ids
xls_report = StringIO.new
book = Spreadsheet::Workbook.new
sheet1 = book.create_worksheet :name => "实训反馈"
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
sheet1.row(0).default_format = blue
count_row = 1
shixuns = Shixun.where(:id => shixun_ids).includes(discusses: [:user])
sheet1.row(0).concat(["序号", "实训ID", "实训名称", "实训作者", "作者单位", "评论数", "评论内容", "关卡", "评论者", "评论者职业",
"评论者单位", "评论时间", "社区导师是否已回复"])
shixuns.each_with_index do |shixun, i|
discusses = shixun.discusses.where("user_id != ?", 1)
sheet1[count_row, 0] = i + 1
sheet1[count_row, 1] = shixun.identifier
sheet1[count_row, 2] = shixun.name
sheet1[count_row, 3] = shixun.owner.show_real_name
sheet1[count_row, 4] = shixun.owner.school_name
sheet1[count_row, 5] = discusses.count
discusses.each_with_index do |discuss, j|
user = discuss.user
sheet1[count_row, 6] = discuss.content.gsub(/<img.*\/>/, "【图片评论】").gsub(/!\[\].+\)/, "【图片评论】")
sheet1[count_row, 7] = "#{discuss.position}"
sheet1[count_row, 8] = user.show_real_name
sheet1[count_row, 9] = user.identity
sheet1[count_row, 10] = user.school_name
sheet1[count_row, 11] = format_time discuss.created_at
sheet1[count_row, 12] = discuss.children.pluck(:user_id).include?(1) ? "" : ""
count_row += 1
end
#count_row += 1
end
book.write xls_report
xls_report.string
end
def competition_member_xls members, competition
xls_report = StringIO.new
book = Spreadsheet::Workbook.new

@ -1,10 +1,10 @@
# encoding: utf-8
class MyshixunsController < ApplicationController
layout 'base_myshixun'
skip_before_filter :verify_authenticity_token, :only => [:training_task_status, :close_webssh]
before_filter :require_login, :except => [:training_task_status, :close_webssh]
skip_before_filter :verify_authenticity_token, :only => [:training_task_status, :close_webssh, :code_runinng_message]
before_filter :require_login, :except => [:training_task_status, :close_webssh, :code_runinng_message]
before_filter :check_authentication, :except => [:training_task_status, :close_webssh, :mul_test_home, :mul_test_user,
:mul_test_myshixun, :mul_test_shixun, :mul_test_start]
:mul_test_myshixun, :mul_test_shixun, :mul_test_start, :code_runinng_message]
before_filter :find_myshixun, :only => [:show, :myshixun_reset, :open_webssh, :sync_reset_time, :destroy, :search_file_list, :vnc]
DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z)
@ -435,6 +435,39 @@ class MyshixunsController < ApplicationController
end
# 代码运行中的信息接口
def code_runinng_message
begin
logger.info("######################params: #{params}")
jsonTestDetails = JSON.parse(params[:jsonTestDetails])
game_id = jsonTestDetails['buildID']
message = jsonTestDetails['textMsg']
logger.info("##################code_runinng_message:#{jsonTestDetails}")
logger.info("##################buildID: #{game_id}")
logger.info("##################textMsg: #{message}")
if game_id.present? && message.present?
game = Game.find game_id
msg = game.run_code_message
# 只有评测中的game才会创建和更新代码评测中的信息
logger.info("##################game: #{game.status}")
logger.info("##################retry_status: #{game.retry_status}")
if game.status == 1 || game.status == 2 && game.retry_status == 1
if msg.blank?
RunCodeMessage.create!(:game_id => game_id, :status => 1, :message => message)
else
msg.update_attributes(:status => (msg.status + 1), :message => message)
end
else
# 评测完成,初始化评测信息的状态
msg.update_attributes(:status => 0, :message => nil) if msg.present?
end
render :json => {:data => "success"}
end
rescue Exception => e
render :json => {:data => "failed, exception_message: #{e}"}
end
end
# taskId 即返回的game id
# 返回结果params [:stauts] 0 表示成功,其它则失败
# msg 错误信息
@ -540,7 +573,7 @@ class MyshixunsController < ApplicationController
logger.info("training_task_status start#4**#{game_id}**** #{Time.now.strftime("%Y-%m-%d %H:%M:%S.%L")}")
render :json => {:data => "success"}
rescue Exception => e
render :json => {:data => "failed"}
render :json => {:data => "failed, errer_message:#{e}"}
logger.error("training_task_status error: #{e}")
raise ActiveRecord::Rollback
end

@ -2,13 +2,16 @@
# REDO: 创建版本库权限控制
class ShixunsController < ApplicationController
layout 'base_shixun'
before_filter :require_login, :except => [:ghook, :download_file]
before_filter :check_authentication, :except => [:ghook, :download_file]
before_filter :require_login, :except => [:ghook, :download_file, :show, :index]
before_filter :check_authentication, :except => [:ghook, :download_file, :show, :index]
before_filter :find_shixun, :except => [ :index, :new, :create, :index, :search, :shixun_courses, :new_disscuss, :shixun_migrate, :qrcode, :download_file, :departments, :get_mirror_script, :send_message_to_administrator]
skip_before_filter :verify_authenticity_token, :only => [:ghook, :download_file]
before_filter :view_allow, :only => [:show, :collaborators, :propaedeutics, :shixun_discuss, :ranking_list]
before_filter :view_allow, :only => [:collaborators, :propaedeutics, :shixun_discuss, :ranking_list]
before_filter :require_manager, :only => [ :settings, :add_script, :publish, :collaborators_delete, :shixun_members_added, :add_collaborators, :update, :destroy]
before_filter :validation_email, :only => [:new]
# 移动云ToC模式权限控制
# before_filter :ecloud_auth, :except => [:show, :index]
include ApplicationHelper
include ShixunsHelper
@ -1160,6 +1163,9 @@ class ShixunsController < ApplicationController
end
def get_script_contents
if params[:script_id].to_i == -1
render :json => {contents: "", description: ""}
else
mirrir_script = MirrorScript.find(params[:script_id])
script = mirrir_script.try(:script)
description = mirrir_script.try(:description)
@ -1167,6 +1173,8 @@ class ShixunsController < ApplicationController
render :json => {contents: script, description: description}
end
end
def get_common_script
shixun_script = PlatformSample.where(:samples_type => "script").first.try(:contents)
compile = params[:compile]

@ -113,7 +113,7 @@ class StudentWorkController < ApplicationController
pass_consume_time += (game.cost_time / 60.0).to_f
end
all_time += (game.cost_time / 60.0).to_f
user_total_score += game.final_score.to_i < 0 ? 0 : game.challenge.score.to_i
user_total_score += game.status == 2 ? game.final_score.to_i < 0 ? 0 : game.challenge.score.to_i : 0
if myshixun.user_id == @work.user.id
@game_user_query << [game.id, game.outputs.first.try(:query_index).to_i]
end

@ -1,8 +1,8 @@
# encoding: utf-8
class SubjectsController < ApplicationController
layout 'base_subject'
before_filter :require_login, :except => [:show]
before_filter :check_authentication, :except => [:show]
before_filter :require_login, :except => [:show, :index]
before_filter :check_authentication, :except => [:show, :index]
before_filter :find_subject, :except => [:index, :new, :create, :create_subject, :new_subject, :append_to_stage, :send_to_course]
include ApplicationHelper

@ -54,7 +54,7 @@ class UsersController < ApplicationController
accept_api_auth :index, :show, :create, :update, :destroy, :tag_save, :tag_saveEx
#william
before_filter :require_login, :only => [:tag_save, :tag_saveEx]
before_filter :require_login, :only => [:tag_save, :tag_saveEx, :search_user_course, :search_user_project]
#before_filter :refresh_changests, :only =>[:user_activities,:user_courses,:user_projects,:user_newfeedback]
#visitor

@ -71,11 +71,11 @@ module ApplicationHelper
end
def ac_pass?(standard_value, real_value)
standard_value && real_value && real_value > standard_value ? "达成" : "未达成"
standard_value && real_value && real_value >= standard_value ? "达成" : "未达成"
end
def ec_pass?(standard_value, real_value)
standard_value && real_value && real_value > standard_value ? 1 : 0
standard_value && real_value && real_value >= standard_value ? 1 : 0
end
# 工程认证删除关联课堂
@ -340,9 +340,6 @@ module ApplicationHelper
# TPM查看权限
# result一般为页面权限
def shixun_view_allow shixun, result = nil
if params[:openi].to_i == 1
result ? false : true
else
if User.current.manager_of_shixun?(shixun)
result ? false : true
else
@ -351,7 +348,6 @@ module ApplicationHelper
end
end
end
end
# 判断TPM的代码是否被修改了
# 判断依据是看tpm的最新提交记录和tpi数据库中存储的commit_id是否一致
@ -619,7 +615,7 @@ module ApplicationHelper
redirect_to user_info_path()
Rails.logger.info("check_authentication end")
return
elsif User.current.certification != 1
elsif User.current.certification != 1 # 系统没有授权
day_cer = UserDayCertification.where(:user_id => User.current.id).last
unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400
redirect_to my_account_path()
@ -6525,6 +6521,67 @@ def visible_task_count course, is_teacher
task_count
end
def update_shixun_work_status homework
shixun = homework.shixuns.first
student_works = homework.student_works.where(:work_status => 0)
homework_challenge_settings = homework.homework_challenge_settings
challeng_ids = homework_challenge_settings.map(&:challenge_id)
# 取已发布的作品
if homework.unified_setting
student_works = student_works
else
setting = homework.homework_group_settings.where("publish_time < '#{Time.now}'")
if setting.blank?
student_works = student_works.where("0=1")
else
users = homework.course.members.where(:course_group_id => setting.map(&:course_group_id))
student_works = student_works.where(:user_id => users.map(&:user_id))
end
end
# 已发布作品且状态为未提交的作品 如果有开启过实训则更新状态
myshixuns = Myshixun.where(:shixun_id => shixun.id, :user_id => student_works.map(&:user_id))
myshixuns.each do |myshixun|
work = student_works.where(:user_id => myshixun.user_id).first
member = Member.find_by_sql("select course_group_id from members where course_id = #{homework.course_id} and user_id = #{work.user_id}").first
setting_time = homework_group_setting homework, member.try(:course_group_id)
games = myshixun.games.where(:challenge_id => challeng_ids)
myshixun_endtime = games.select{|game| game.status == 2}.size == games.size ? games.map(&:end_time).max : nil
compelete_status = 0
if myshixun_endtime.present? && myshixun_endtime < setting_time.end_time
if myshixun_endtime < setting_time.publish_time
compelete_status = 2
else
compelete_status = 1
end
end
if setting_time.end_time > Time.now
work.update_attributes(:work_status => 1, :late_penalty => 0, :commit_time => myshixun.updated_at, :update_time => myshixun.updated_at, :myshixun_id => myshixun.id, :compelete_status => compelete_status)
else
work.update_attributes(:work_status => ((myshixun.is_complete? && (myshixun.done_time < setting_time.end_time)) ? 1 : 2), :late_penalty => (myshixun.is_complete? && (myshixun.done_time < setting_time.end_time) ? 0 : homework.late_penalty), :commit_time => myshixun.updated_at, :update_time => myshixun.updated_at, :myshixun_id => myshixun.id, :compelete_status => compelete_status)
end
set_shixun_final_score work, homework.homework_detail_manual.answer_open_evaluation, homework_challenge_settings
end
# 更新所有学生的效率分
update_student_eff_score HomeworkCommon.where(:id => homework.id).first
=begin
student_works.each do |work|
if work.work_status == 0
myshixun = Myshixun.where(:shixun_id => shixun.id, :user_id => work.user_id).first
if myshixun
member = Member.find_by_sql("select course_group_id from members where course_id = #{homework.course_id} and user_id = #{User.current.id}").first
setting_time = homework_group_setting homework, member.try(:course_group_id)
if setting_time.end_time > Time.now
work.update_attributes(:work_status => 1, :late_penalty => 0, :commit_time => myshixun.updated_at, :update_time => myshixun.updated_at, :myshixun_id => myshixun.id)
else
work.update_attributes(:work_status => ((myshixun.is_complete? && (myshixun.done_time < setting_time.end_time)) ? 1 : 2), :late_penalty => (myshixun.is_complete? && (myshixun.done_time < setting_time.end_time) ? 0 : homework.late_penalty), :commit_time => myshixun.updated_at, :update_time => myshixun.updated_at, :myshixun_id => myshixun.id)
end
end
end
set_shixun_final_score work, homework.homework_detail_manual.answer_open_evaluation, homework_challenge_settings
end
=end
end
#成绩计算
def set_final_score homework,student_work
if homework && homework.homework_detail_manual && !student_work.ultimate_score

@ -5,7 +5,7 @@ module ShixunsHelper
def myshixun_exp myshixun
score = 0
myshixun.games.each do |game|
score += game.final_score.to_i < 0 ? 0 : game.challenge.score.to_i
score += game.status == 2 ? game.final_score.to_i < 0 ? 0 : game.challenge.score.to_i : 0
end
score
end

@ -3,67 +3,6 @@ include UserScoreHelper
module StudentWorkHelper
def update_shixun_work_status homework
shixun = homework.homework_commons_shixuns.shixun
student_works = homework.student_works.where(:work_status => 0)
homework_challenge_settings = homework.homework_challenge_settings
challeng_ids = homework_challenge_settings.map(&:challenge_id)
# 取已发布的作品
if homework.unified_setting
student_works = student_works
else
setting = homework.homework_group_settings.where("publish_time < '#{Time.now}'")
if setting.blank?
student_works = student_works.where("0=1")
else
users = homework.course.members.where(:course_group_id => setting.map(&:course_group_id))
student_works = student_works.where(:user_id => users.map(&:user_id))
end
end
# 已发布作品且状态为未提交的作品 如果有开启过实训则更新状态
myshixuns = Myshixun.where(:shixun_id => shixun.id, :user_id => student_works.map(&:user_id))
myshixuns.each do |myshixun|
work = student_works.where(:user_id => myshixun.user_id).first
member = Member.find_by_sql("select course_group_id from members where course_id = #{homework.course_id} and user_id = #{work.user_id}").first
setting_time = homework_group_setting homework, member.try(:course_group_id)
games = myshixun.games.where(:challenge_id => challeng_ids)
myshixun_endtime = games.select{|game| game.status == 2}.size == games.size ? games.map(&:end_time).max : nil
compelete_status = 0
if myshixun_endtime.present? && myshixun_endtime < setting_time.end_time
if myshixun_endtime < setting_time.publish_time
compelete_status = 2
else
compelete_status = 1
end
end
if setting_time.end_time > Time.now
work.update_attributes(:work_status => 1, :late_penalty => 0, :commit_time => myshixun.updated_at, :update_time => myshixun.updated_at, :myshixun_id => myshixun.id, :compelete_status => compelete_status)
else
work.update_attributes(:work_status => ((myshixun.is_complete? && (myshixun.done_time < setting_time.end_time)) ? 1 : 2), :late_penalty => (myshixun.is_complete? && (myshixun.done_time < setting_time.end_time) ? 0 : homework.late_penalty), :commit_time => myshixun.updated_at, :update_time => myshixun.updated_at, :myshixun_id => myshixun.id, :compelete_status => compelete_status)
end
set_shixun_final_score work, homework.homework_detail_manual.answer_open_evaluation, homework_challenge_settings
end
# 更新所有学生的效率分
update_student_eff_score HomeworkCommon.where(:id => homework.id).first
=begin
student_works.each do |work|
if work.work_status == 0
myshixun = Myshixun.where(:shixun_id => shixun.id, :user_id => work.user_id).first
if myshixun
member = Member.find_by_sql("select course_group_id from members where course_id = #{homework.course_id} and user_id = #{User.current.id}").first
setting_time = homework_group_setting homework, member.try(:course_group_id)
if setting_time.end_time > Time.now
work.update_attributes(:work_status => 1, :late_penalty => 0, :commit_time => myshixun.updated_at, :update_time => myshixun.updated_at, :myshixun_id => myshixun.id)
else
work.update_attributes(:work_status => ((myshixun.is_complete? && (myshixun.done_time < setting_time.end_time)) ? 1 : 2), :late_penalty => (myshixun.is_complete? && (myshixun.done_time < setting_time.end_time) ? 0 : homework.late_penalty), :commit_time => myshixun.updated_at, :update_time => myshixun.updated_at, :myshixun_id => myshixun.id)
end
end
end
set_shixun_final_score work, homework.homework_detail_manual.answer_open_evaluation, homework_challenge_settings
end
=end
end
#获取当前用户的项目列表
def user_projects_option
projects = User.current.projects.visible

@ -4,7 +4,7 @@ class Department < ActiveRecord::Base
# apply_add_departments 不能关联删除 tidings表有关联
has_many :apply_add_departments
has_many :tidings, as: :container, dependent: :destroy
attr_accessible :name, :school_id, :is_auth, :identifier, :is_delete
attr_accessible :name, :school_id, :is_auth, :identifier, :is_delete, :host_count
scope :is_active, lambda{where(:is_delete => false)}
scope :is_delete, lambda{where(:is_delete => true)}

@ -1,3 +1,4 @@
# ket值license表示人数对应企业版duration表示月数对应个人版
class EcloudServieceServicepara < ActiveRecord::Base
attr_accessible :key, :value, :ecloud_service_id
belongs_to :ecloud_service

@ -13,6 +13,7 @@ class Game < ActiveRecord::Base
has_many :challenge_samples
has_many :game_codes, :dependent => :destroy
has_many :evaluate_records, :dependent => :destroy
has_one :run_code_message, :dependent => :destroy
include ApplicationHelper
scope :min, lambda { select([:id, :status, :myshixun_id, :user_id, :final_score, :challenge_id, :identifier,

@ -0,0 +1,5 @@
class RunCodeMessage < ActiveRecord::Base
# attr_accessible :title, :body
belongs_to :game
end

@ -1693,6 +1693,11 @@ class User < Principal
end
def self.create_with_ecoder!(info)
user = User.find_by_phone(info["mobile"])
# 如果手机号存在,则直接绑定用户
# 因为手机号可以取回密码,所以可以视为同一用户
unless user
user = User.new
user.admin = false
user.login = "ecoder_" + info["mobile"]
@ -1718,6 +1723,7 @@ class User < Principal
ue = user.user_extensions ||= UserExtensions.new
ue.user_id = user.id
ue.save!
end
user
end

@ -498,7 +498,9 @@ class GamesService
# 更新评测次数
game.update_column(:evaluate_count, (game.evaluate_count.to_i + 1))
# 清空代码评测信息
msg = game.run_code_message
msg.update_attributes(:status => 0, :message => nil) if msg.present?
# 更新时间是为了TPM端显示的更新退出实训及访问实训的时候会更新
myshixun.update_column(:updated_at, Time.now)
@ -793,7 +795,10 @@ class GamesService
# 如果没有超时并且正在评测中
# 判断评测中的状态有两种1、如果之前没有通关的只需判断status为1即可如果通过关则判断game的resubmit_identifier是否更新
if (params[:time_out] == "false") && ((params[:resubmit].blank? && game.status==1) || (params[:resubmit].present? && (params[:resubmit] != resubmit_identifier)))
return
# 代码评测的信息
running_code_status = game.run_code_message.try(:status)
running_code_message = game.run_code_message.try(:message)
return {:running_code_status => running_code_status, :running_code_message => running_code_message}
end
Rails.logger.info("##### resubmit_identifier is #{resubmit_identifier}")
@ -886,8 +891,10 @@ class GamesService
next_game = Game.next_game(shixun.id, game.myshixun_id, game_challenge.position).try(:identifier)
output_hash = {:test_sets => test_sets, :had_test_count => test_sets_count, :test_sets_count => test_sets_count, :had_passed_testsests_error_count => had_passed_testsests_error_count}
return {:grade => grade, :gold => score, :experience => experience, :status => game_status, :had_done => had_done, :position => game_challenge.position,
:port => port, :power => power, :record => record, :mirror_name => mirror_name, :picture => picture, :web_route => web_route, :latest_output => latest_output,
return {:grade => grade, :gold => score, :experience => experience, :status => game_status, :had_done => had_done,
:position => game_challenge.position, :port => port, :power => power, :record => record,
:mirror_name => mirror_name, :picture => picture, :web_route => web_route, :latest_output => latest_output,
:star => game.star, :next_game => next_game, :prev_game => prev_game}.merge(output_hash)
end

@ -125,9 +125,21 @@ class ShixunsService
praise_count = d.praise_tread.where(:praise_or_tread => 1).count
user_praise= d.praise_tread.select{|pt| pt.user_id == current_user.id}.length > 0 ? true : false
# 实训TPM的管理员可以看到隐藏的评论
parents = {:id => d.id, :content => d.content, :time => time_from_now(d.created_at), :position => d.position, :user_id => d.user.try(:id), :reward => d.reward,
:image_url => url_to_avatar(d.user), :username => d.username, :user_login => d.user.try(:login), :shixun_id => dis.id, :hidden => d.hidden,
:manager => current_user.manager_of_shixun?(dis, current_user), :praise_count => praise_count, :user_praise => user_praise, :admin => current_user.admin?}
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
"/tasks/#{game_identifier}"
else
""
end
parents = {:id => d.id, :content => d.content, :time => time_from_now(d.created_at), :position => d.position,
:user_id => d.user.try(:id), :reward => d.reward, :image_url => url_to_avatar(d.user),
:username => d.username, :user_login => d.user.try(:login), :shixun_id => dis.id, :hidden => d.hidden,
:manager => manager, :praise_count => praise_count, game_url: game_url,
:user_praise => user_praise, :admin => current_user.admin?}
# 现在没有二级回复所以查询的时候直接从root_id取
children = Discuss.where(:root_id => d.id).includes(:user).reorder("created_at asc")

@ -10,6 +10,9 @@
<ul class="abouttable clearfix">
<li class="clearfix">
<label class="second-label fl"><span class="color-orange">* </span>职业:</label>
<% if @user.certification == 1 %>
<input type="hidden" id="user_certi_identity" value="<%= @user.user_extensions.identity %>">
<% end %>
<select id="userIdentity" name="identity" class="fl winput-240-40">
<option value="-1" style="display:none">请选择职业</option>
<option value="0">教师</option>

@ -28,6 +28,9 @@
<ul class="abouttable clearfix">
<li class="clearfix">
<label class="second-label fl"><span class="color-orange">* </span>职业:</label>
<% if @user.certification == 1 %>
<input type="hidden" id="user_certi_identity" value="<%= @user.user_extensions.identity %>">
<% end %>
<select id="userIdentity" name="identity" class="fl winput-240-40">
<option value="-1" style="display:none">请选择职业</option>
<option value="0">教师</option>

@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><meta name="renderer" content="webkit"/><meta name="force-rendering" content="webkit"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><link rel="manifest" href="/manifest.json"><link rel="shortcut icon" href="/favicon.ico"><title>Educoder</title><script type="text/javascript">window.__isR=!0</script><link rel="stylesheet" href="/react/build/css/css_min_all.css"><link rel="stylesheet" href="/assets/iconfont/iconfont.css"><link href="/react/build/./static/css/main.80b6ec5e.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="md_div" style="display:none"></div><div id="root" class="page -layout-v -fit"></div><div id="picture_display" style="display:none"></div><script type="text/javascript" src="/react/build/js/js_min_all.js"></script><script type="text/javascript" src="/assets/kindeditor/kindeditor.js"></script><script type="text/javascript" src="/react/build/js/create_kindeditor.js"></script><script type="text/javascript" src="/javascripts/educoder/edu_application.js"></script><script type="text/javascript" src="/react/build/./static/js/main.b4ee5e8a.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><meta name="renderer" content="webkit"/><meta name="force-rendering" content="webkit"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><link rel="manifest" href="/manifest.json"><link rel="shortcut icon" href="/favicon.ico"><title>Educoder</title><script type="text/javascript">window.__isR=!0</script><link rel="stylesheet" href="/react/build/css/css_min_all.css"><link rel="stylesheet" href="/assets/iconfont/iconfont.css"><link href="/react/build/./static/css/main.c95e49c6.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="md_div" style="display:none"></div><div id="root" class="page -layout-v -fit"></div><div id="picture_display" style="display:none"></div><script type="text/javascript" src="/react/build/js/js_min_all.js"></script><script type="text/javascript" src="/assets/kindeditor/kindeditor.js"></script><script type="text/javascript" src="/react/build/js/create_kindeditor.js"></script><script type="text/javascript" src="/javascripts/educoder/edu_application.js"></script><script type="text/javascript" src="/react/build/./static/js/main.21bade1d.js"></script></body></html>

@ -17,7 +17,7 @@
</div>
<li class="clearfix mt10 edu-txt-center">
<a href="javascript:void(0);" class="task-btn mr10" onclick="hideModal()">取消</a>
<a href="javascript:void(0);" class="task-btn task-btn-orange ml20" onclick="submit_data();">确定</a>
<a href="javascript:void(0);" class="task-btn task-btn-orange ml20" onclick="submit_data(); hideModal();">确定</a>
</li>
</div>
</div>

@ -1,6 +1,7 @@
<% if @status.to_i == -1 %>
notice_box("该界别已经存在,请勿重复创建")
<% else %>
$("#year_list").html('<%= j(render :partial => "ec_major_schools/year_list") %>')
hideModal();
window.location.reload();
console.log("##########<%= @years.count %>")
//$("#year_list").html('<%#= j(render :partial => "ec_major_schools/year_list") %>')
<% end %>

@ -5,7 +5,7 @@
<li class="<%= subjects_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "实训课程", subjects_path %></li>
<li class="<%= course_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "翻转课堂", courses_path %></li>
<!-- 精选实训 -->
<li class="pr<%= shixuns_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "开发社区", shixuns_path %><img src="/images/educoder/hot-h.png" class="nav-img" /></li>
<li class="pr <%= shixuns_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "开发社区", shixuns_path %><img src="/images/educoder/hot-h.png" class="nav-img" /></li>
<% careers = Career.published.order("created_at asc") %>
<% if careers.present? %>

@ -3,16 +3,14 @@
<div class="head-nav pr">
<ul id="header-nav">
<li class="active" style="display: none"><%= link_to "首页", home_path %></li>
<li><%= link_to "实训课程", subjects_path %></li>
<li><%= link_to "翻转课堂", courses_path %></li>
<li class="<%= subjects_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "实训课程", subjects_path %></li>
<li class="<%= course_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "翻转课堂", courses_path %></li>
<li class="pr <%= shixuns_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "开发社区", shixuns_path %><img src="/images/educoder/hot-h.png" class="nav-img" /></li>
<li class="pr">
<%= link_to "开发社区", shixuns_path %>
<img src="/images/educoder/hot-h.png" class="nav-img" />
</li>
<% careers = Career.published.order("created_at asc") %>
<% if careers.present? %>
<li class="fl edu-menu-panel headIcon careershover" style="cursor: auto;">
<li class="fl edu-menu-panel headIcon careershover <%= params[:action] == "index" && params[:controller] == "careers" ? " active" : "" %>" style="cursor: auto;">
<p>职业路径</p>
<ul class="edu-menu-list edu-menu-listnew" style="top:60px">
<% careers.each do |career| %>
@ -21,8 +19,8 @@
</ul>
</li>
<% end %>
<li><%= link_to "竞赛", competitions_path %></li>
<li><%= link_to "问答", forums_path %></li>
<li class="<%= params[:controller] == "competitions" ? " active" : "" %>"><%= link_to "竞赛", competitions_path %></li>
<li class="<%= params[:controller] == "forums" ? " active" : "" %>"><%= link_to "问答", forums_path %></li>
<!--<li><%#= link_to "活动竞赛", competitions_path %></li>-->
</ul>
<div class="posi-search unlogin" id="posi-search" style="display: none" >
@ -89,21 +87,5 @@
window.onscroll=function(){
var sl=-Math.max(document.body.scrollLeft,document.documentElement.scrollLeft);
document.getElementById('nHeader').style.left=sl+'px';
}
$(function () {
var $header = $("#header-nav").children("li");
<% if params[:controller] == "welcome" %>
$("#header-nav").children("li").eq(0).addClass("active");
<% elsif subjects_controller.include?(params[:controller]) %>
$("#header-nav").children("li").eq(1).addClass("active");
<% elsif course_controller.include?(params[:controller]) %>
$("#header-nav").children("li").eq(2).addClass("active");
<% elsif shixuns_controller.include?(params[:controller]) %>
$header.length == 7 ? $header.eq(2).addClass("active") : $header.eq(3).addClass("active");
<% elsif params[:controller] == "competitions" %>
$header.length == 7 ? $header.eq(5).addClass("active") : $header.eq(4).addClass("active");
<% elsif params[:controller] == "forums" %>
$header.length == 7 ? $header.eq(6).addClass("active") : $header.eq(5).addClass("active");
<% end %>
})
};
</script>

@ -36,6 +36,14 @@
</div>
</div>
<% end %>
<div class="mt20 mb20" style="text-align:center;">
<div class="pages_user_show" style="width:auto; display:inline-block;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @authorizations_pages, @authorizations_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>
<% else %>
<%= render :partial => "welcome/no_data" %>
<% end %>

@ -27,6 +27,15 @@
</div>
<% end %>
<div class="mt20 mb20" style="text-align:center;">
<div class="pages_user_show" style="width:auto; display:inline-block;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @authorizations_pages, @authorizations_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>
<!--<div style="text-align:center;">-->
<!--<div class="pages_right_min" style="width:auto; display:inline-block;">-->
<!--<ul id="homework_pository_ref_pages">-->

@ -65,15 +65,9 @@
}else{
var order = "desc"
}
var user_status = $("input[name='user_status']").val();
var research_condition = $("input[name='research_condition']").val();
var research_contents = $("input[name='research_contents']").val();
$.ajax({
url: "<%= users_managements_path %>",
type: "post",
dataType: "script",
data: {us_order : order, order_key: "created_on", user_status:user_status, research_condition:research_condition, research_contents:research_contents}
});
$("input[name='us_order']").val(order);
$("input[name='order_key']").val("created_on");
$("#managements_users_search").submit();
});
// 按最后登录时间排序
$("#user_last_order").on("click", function(){
@ -83,15 +77,9 @@
}else{
var order = "desc"
}
var user_status = $("input[name='user_status']").val();
var research_condition = $("input[name='research_condition']").val();
var research_contents = $("input[name='research_contents']").val();
$.ajax({
url: "<%= users_managements_path %>",
type: "post",
dataType: "script",
data: {us_order : order, order_key: "last_login_on", user_status:user_status, research_condition:research_condition, research_contents:research_contents}
});
$("input[name='us_order']").val(order);
$("input[name='order_key']").val("last_login_on");
$("#managements_users_search").submit();
});
// 按经验值排序
$("#user_experience_order").on("click", function(){
@ -101,16 +89,10 @@
}else{
var order = "desc"
}
var user_status = $("input[name='user_status']").val();
var research_condition = $("input[name='research_condition']").val();
var research_contents = $("input[name='research_contents']").val();
$.ajax({
url: "<%= users_managements_path %>",
type: "post",
dataType: "script",
data: {us_order : order, order_key: "experience", user_status:user_status, research_condition:research_condition, research_contents:research_contents}
$("input[name='us_order']").val(order);
$("input[name='order_key']").val("experience");
$("#managements_users_search").submit();
});
})
// 按金币排序
$("#user_grade_order").on("click", function(){
@ -120,14 +102,8 @@
}else{
var order = "desc"
}
var user_status = $("input[name='user_status']").val();
var research_condition = $("input[name='research_condition']").val();
var research_contents = $("input[name='research_contents']").val();
$.ajax({
url: "<%= users_managements_path %>",
type: "post",
dataType: "script",
data: {us_order : order, order_key: "grade", user_status:user_status, research_condition:research_condition, research_contents:research_contents}
});
$("input[name='us_order']").val(order);
$("input[name='order_key']").val("grade");
$("#managements_users_search").submit();
})
</script>

@ -1,14 +1,20 @@
<div class="edu-class-container">
<%#= form_tag(url_for(shixuns_managements_path), :id => "managements_shixuns_search", :method => "post", :remote => true ) do %>
<!--<div class="edu-con-top clearfix mb20">-->
<!--<input class="fl task-form-20 task-height-30 ml25" id="shixun_Look_name" name="search" maxlength="" placeholder="输入实训名称关键字进行搜索" type="text" style="height: 21px;">-->
<!--<li class="fl ml10">-->
<!--<a href="javascript:void(0)" class="task-btn task-btn-orange" onclick="$('#managements_shixuns_search').submit();">搜索</a>-->
<!--<a href="javascript:clearSearchCondition();" class="task-btn mr10">清除</a>-->
<!--</li>-->
<!--</div>-->
<%# end %>
<%= form_tag(url_for(shixun_feedback_message_managements_path), :id => "managements_shixuns_search", :method => "post", :remote => true ) do %>
<div class="edu-con-top clearfix mb20">
<input class="fl task-form-20 task-height-30 ml25" id="shixun_Look_name" name="search" maxlength="" placeholder="输入实训名称关键字进行搜索" type="text" style="height: 21px;">
<li class="fl ml10">
<a href="javascript:void(0)" class="task-btn task-btn-orange" onclick="$('#managements_shixuns_search').submit();">搜索</a>
<a href="javascript:clearSearchCondition();" class="task-btn mr10">清除</a>
</li>
<a href="<%= shixun_feedback_message_managements_path(:search => @search, :format => "xls") %>" id="shixun_search" class="task-btn mr10 task-btn-orange fr">导出</a>
</div>
<% end %>
<div class="ex_container" id="management_shixun_feedback_list">
<%= render :partial => "shixun_feedback_list" %>
</div>
</div>
<script>
function clearSearchCondition(){
$("#shixun_Look_name").val('')
}
</script>

@ -1 +1,2 @@
$("#management_shixun_feedback_list").html("<%= j(render :partial => 'shixun_feedback_list') %>");
$("#shixun_search").attr("href", "<%= shixun_feedback_message_managements_path(:search => @search, :format => "xls") %>")

@ -28,11 +28,22 @@
<div id="edu-tab-con-2" class="undis">
<div class="mt10">
<p class="fl task-form-40 mt8 ml15 clearfix">
<p class="fl task-form-20 mt8 ml15 clearfix">
<a href="javascript:void(0);" class="edu-filter-cir-grey mr5 fl font-12 active" id="audit_all_authentication">全部</a>
<a href="javascript:void(0);" class="edu-filter-cir-grey mr5 fl font-12" id="audit_agree_authentication">同意</a>
<a href="javascript:void(0);" class="edu-filter-cir-grey mr5 fl font-12" id="audit_reject_authentication" >拒绝</a>
</p>
<select id="user_identity" name="identity" class="fl winput-120-40 ml15 mt5">
<option value="-1">请选择职业</option>
<option value="0">教师</option>
<option value="1">学生</option>
<option value="2">专业人士</option>
</select>
<select id="auto_school" name="auto_school" class="fl winput-120-40 ml15 mt5">
<option value="0">全部</option>
<option value="1">自动授权</option>
<option value="2">非自动授权</option>
</select>
<div class="edu-position fr task-form-30 mb10 fr mr15">
<input class="task-form-100 panel-box-sizing " placeholder="输入真实姓名进行检索" type="text" id="audit_search_name">
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey mt10" id="audit_search"><i class="fa fa-search"></i></a>
@ -91,45 +102,38 @@
});
/* ----------------------- 已审批(全部) ------------------------- */
$("#audit_all_authentication").on("click", function(){
var iName = $("#audit_search_name").val();
var sName = $("#school_search_name").val();
$.ajax({
url: "<%= trial_authorization_managements_path %>" + ".js",
data: { name: iName, status: [1, 2], sname: sName }
});
});
$("#audit_all_authentication").on("click", function(){search_func([1, 2]);});
/* ----------------------- 已审批(同意) ------------------------- */
$("#audit_agree_authentication").live("click", function(){
var iName = $("#audit_search_name").val();
var sName = $("#school_search_name").val();
$.ajax({
url: "<%= trial_authorization_managements_path %>" +".js",
data: { name: iName, status: 1, sname: sName}
});
});
$("#audit_agree_authentication").live("click", function(){search_func(1);});
/* ----------------------- 已审批(拒绝) ------------------------- */
$("#audit_reject_authentication").live("click", function(){
var iName = $("#audit_search_name").val();
var sName = $("#school_search_name").val();
$("#audit_reject_authentication").live("click", function(){search_func(2);});
$.ajax({
url: "<%= trial_authorization_managements_path %>" +".js",
data: { name: iName, status: 2, sname: sName }
});
/* ------------------- 按名字进行搜索(已审批)-------------------- */
$("#audit_search").live("click", function(){search_func(0);});
$("#user_identity").on("change", function(){search_func(0);});
$("#auto_school").on("change", function(){search_func(0);});
$("#audit_search_name, #school_search_name").on("keydown", function(e){
// 兼容FF和IE和Opera
var theEvent = e || window.event;
var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
if (code == 13) {
//回车执行查询
search_func(0);
}
});
/* ------------------- 按名字进行搜索(已审批)-------------------- */
$("#audit_search").live("click", function(){
function search_func(status){
var iName = $("#audit_search_name").val();
var sName = $("#school_search_name").val();
var identity = $("#user_identity").val();
var auto_school = $("#auto_school").val();
var type = status;
if(type == 0){
var id = $("#audit_all_authentication").parent().find(".active").attr("id");
var type = 0;
if(id == "audit_all_authentication"){
type = [1, 2];
@ -138,12 +142,15 @@
}else{
type = 2;
}
// alert(type);
}
$.ajax({
url: "<%= trial_authorization_managements_path %>" +".js",
data: { search: iName, status: type, sname: sName}
});
data: { search: iName, status: type, sname: sName, identity: identity, auto_school: auto_school}
});
}
// $(document).keyup(function(event){
// if(event.keyCode == 13){

@ -1,7 +1,7 @@
<div class="edu-class-top mt15 clearfix bor-grey-e">
<%= form_tag(url_for(users_managements_path), :id => "managements_users_search", :method => "post", :remote => true) do %>
<div class=" edu-position edu-admin-select fl mr10" style="width:140px;" >
<p>全部状态<i class="fa fa-caret-down ml10" ></i></p>
<div class=" edu-position edu-admin-select fl mr10" style="width:140px;">
<p>全部状态<i class="fa fa-caret-down ml10"></i></p>
<input type="hidden" name="user_status" value="0">
<ul class="edu-admin-option">
<li data-val="0">全部状态</li>
@ -10,7 +10,7 @@
<li data-val="3">已锁定(<%= query_user_status_num 3 %></li>
</ul>
</div>
<div class="edu-position edu-admin-select fl mr10" style="width:150px;">
<div class="edu-position edu-admin-select fl mr10" style="width:120px;">
<p>真实姓名搜索<i class="fa fa-caret-down ml10"></i></p>
<input type="hidden" name="research_condition" value="name">
<ul class="edu-admin-option">
@ -20,17 +20,33 @@
<li data-val="phone">手机号码搜索</li>
</ul>
</div>
<div class="fl with20">
<select id="user_identity" name="identity" class="fl winput-100-40 ml10">
<option value="-1">请选择职业</option>
<option value="0">教师</option>
<option value="1">学生</option>
<option value="2">专业人士</option>
</select>
<select id="auto_school" name="auto_school" class="fl winput-100-40 ml10">
<option value="0">全部</option>
<option value="1">自动授权</option>
<option value="2">非自动授权</option>
</select>
<div class="fl with15 ml10">
<input type="text" class="fl task-form-100 task-height-40 panel-box-sizing" name="research_contents" placeholder="输入关键字进行搜索">
</div>
<li class="fl task-height-30 ml10" style="display: inline-block">
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="school" class="task-height-40 panel-box-sizing fl" type="text" placeholder="请输入单位名称关键字进行搜索" style="width: 260px" />
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="school" class="task-height-40 panel-box-sizing fl" type="text" placeholder="请输入单位名称关键字进行搜索" style="width: 200px"/>
<input nhname="tag" nh_tag_5="true" class="fl" id="school_id" name="school_id" style="display:none;" type="text"/> <!-- 单位名称的test框选中下拉列表框的id -->
<div class="cl"></div>
</li>
<div id="search_school_result_list" style="width: 330px;line-height: 1.5;min-height:20px; max-height: 200px; height: auto !important;display:none;background: white;overflow: scroll;border: solid 1px #cccccc; overflow-x: hidden; overflow-y: auto;">
</div>
<input type="hidden" name="us_order" value="">
<input type="hidden" name="order_key" value="">
<a href="javascript:void(0);" class="fl task-btn task-btn-orange ml5 mt5" onclick="$('#managements_users_search').submit();">搜索</a>
<a href="javascript:void(0);" class="fl task-btn ml5 mt5" id="clear_contents">清除</a>
@ -42,7 +58,7 @@
<%= render :partial => "managements/user_list" %>
</div>
<script>
function import_course_members(){
function import_course_members() {
var htmlvalue = '<%= escape_javascript(render :partial => 'student_work/import_excel_score') %>';
pop_box_new(htmlvalue, 452, 163);
$("#submit_url").val('<%= import_course_members_managements_path() %>');
@ -56,7 +72,7 @@
var d_count = 0; //查询结果的总量
var d_maxPage = 0;//最大页面值
function department_search_fn(e) {
if($(e.target).val().trim() == ''){
if ($(e.target).val().trim() == '') {
$("#search_school_result_list").hide();
$("input[name='school_id']").val("");
return;
@ -94,9 +110,10 @@
}
});
}
//修改部门
function changeSchoolValue(value, data) {
console.log(value+","+data)
console.log(value + "," + data)
$("input[name='school']").val(value);
$("input[name='school_id']").val(data);
$("#search_school_result_list").hide();

@ -5,10 +5,6 @@
SearchByName_poll();
}
}
$(function () {
});
</script>
<div class="edu-class-container edu-position">
<p class="mb10 font-14">
@ -24,7 +20,7 @@
</p>
<%= link_to "返回", poll_index_path(:course_id => @course.id), :class => "fr font-12 mr15 mt3 color-grey" %>
</div>
<div class="edu-tab clearfix mb20">
<div class="clearfix mb20">
<ul id="edu-tab-nav" class="border-bottom-orange">
<li id="edu-tab-nav-1" class="new-tab-nav background-orange" onclick="HoverLi(1);">
<a href="javascript:void(0);" class="tab_type">答题列表</a>
@ -78,7 +74,7 @@
<% end %>
<% end %>
</ul>
<div id="edu-tab-con-1">
<div id="edu-tab-con-1" class="edu-back-white">
<div id="list_count" class="user_bg_shadow bor-grey-e padding15">
<!--老师显示部分-->
<% if @is_teacher %>
@ -104,9 +100,9 @@
<span class="fl mr25">
<a href="javascript:void(0);" id="poll_status_no_limit" class="<%= @status.blank? ? 'check_on' : '' %> pl5 pr5">不限</a>
</span>
<input id="work_status_1" class="magic-checkbox fl" type="checkbox" value="0" name="poll_status[]" <%= !@status.blank? && @status.include?('0') ? 'checked' : '' %>>
<input id="work_status_1" class="magic-checkbox fl" type="checkbox" value="0" name="poll_status[]" <%= !@status.blank? && @status.include?('0') ? 'checked' : '' %> />
<label for="work_status_1" class="fl mr25">未提交(<%= un_commit_num @poll %>)</label>
<input id="work_status_2" class="magic-checkbox fl" type="checkbox" value="1" name="poll_status[]" <%= !@status.blank? && @status.include?('1') ? 'checked' : '' %>>
<input id="work_status_2" class="magic-checkbox fl" type="checkbox" value="1" name="poll_status[]" <%= !@status.blank? && @status.include?('1') ? 'checked' : '' %> />
<label for="work_status_2" class="fl mr25">按时提交(<%= has_commit_num @poll %>)</label>
</li>
<li class="clearfix mb5">
@ -121,7 +117,7 @@
<% groups = @course.course_groups %>
<% end %>
<% groups.each do |group| %>
<input id="group_<%= group.id %>" class="magic-checkbox fl" type="checkbox" value="<%= group.id %>" name="poll_group[]" <%= !@group.blank? && @group.include?(group.id) ? 'checked' : '' %>>
<input id="group_<%= group.id %>" class="magic-checkbox fl" type="checkbox" value="<%= group.id %>" name="poll_group[]" <%= !@group.blank? && @group.include?(group.id) ? 'checked' : '' %> />
<label for="group_<%= group.id %>" class="fl mr25"><%= group.name %>(<%= group.members.count %>)</label>
<% end %>
<% if !@group_teacher %>
@ -134,7 +130,7 @@
<li class="clearfix mt5 mb10">
<div class="edu-find fr mr20 with20 pr">
<div class="edu-find-input">
<input type="text" class="with100 panel-box-sizing" maxlength="20" placeholder="姓名、学号关键字检索" value="<%= @name %>" id="student_user_name">
<input type="text" class="with100 panel-box-sizing" maxlength="20" placeholder="姓名、学号关键字检索" value="<%= @name %>" id="student_user_name" />
<!--<i class="fa fa-close mr5 color-grey edu-close" onclick="colse_searchbox();"></i>-->
<span class="edu-close" onclick="clear_searchbox();" data-tip-down="关闭">×</span>
</div>
@ -235,11 +231,11 @@
<% poll_answers.each_with_index do |poll_answer, index| %>
<li class="clearfix">
<% if poll_answer.answer_text != '' %>
<input class="magic-checkbox fl mt5 magic-checkbox_show" id="poll_<%= poll_answer.id %>_poll_answer_id" type="checkbox">
<input class="magic-checkbox fl mt5 magic-checkbox_show" id="poll_<%= poll_answer.id %>_poll_answer_id" type="checkbox"/>
<label class="fl color-grey3" for="poll_<%= poll_answer.id %>_poll_answer_id"><%= poll_answer.answer_text %></label>
<% else %>
<span class="fl mr5">
<input class="ml-3 mr5 magic-checkbox" id="sx_<%= poll_answer.id %>" name="<%= poll_question %>" value="" type="checkbox">
<input class="ml-3 mr5 magic-checkbox" id="sx_<%= poll_answer.id %>" name="<%= poll_question %>" value="" type="checkbox"/>
<label for="sx_<%= poll_answer.id %>">其它</label>
</span>
<input type="text" readonly class="fl other_input with90 mt3"/>
@ -257,7 +253,7 @@
</div>
</div>
</div>
<div id="edu-tab-con-4" class="user_bg_shadow bor-grey-e undis">
<div id="edu-tab-con-4" class="user_bg_shadow bor-grey-e undis edu-back-white">
<%= render :partial => "poll_setting" %>
</div>
</div>

@ -85,8 +85,9 @@
<div class="clearfix">
<div class="with15 pr fl" <%= @power ? "select-for" : "" %>>
<input type="hidden" name="mirror_script" id="shixun_scenario" value="<%= @shixun.script_tag.try(:id) %>">
<input type="text" id="shixun_scenario_name" class="task-height-40 task-form-100 panel-box-sizing pr20 color-grey3 font-14" readonly placeholder="请选择脚本" value="<%= @shixun.script_tag.try(:script_type) %>"/>
<input type="text" id="shixun_scenario_name" class="task-height-40 task-form-100 panel-box-sizing pr20 color-grey3 font-14" readonly placeholder="请选择脚本" value="<%= @shixun.script_tag.try(:script_type) ? @shixun.script_tag.try(:script_type) : "无" %>"/>
<div class="down-select bor-grey-e user_bg_shadow" id="shixun_scenario_option">
<p data-shixun-value="-1" title="无">无</p>
<% @shixun.standrad_script.each do |script| %>
<p data-shixun-value="<%= script.id %>" title="<%= script.script_type %>"><%= script.script_type %></p>
<% end %>

@ -15,7 +15,7 @@
<% if @shixun.myshixuns.count > 0 %>
<li>
<span>学习人数</span>
<span><%= @shixun.myshixuns.count %></span>
<span><%= @shixun.myshixuns_count %></span>
</li>
<% end %>
<li>
@ -101,7 +101,7 @@
<% end %>
<a href="javascript:void(0);" class="fr user_default_btn edu-greyback-btn mr15 font-18">已关闭</a>
<% end %>
<% if @shixun.can_copy %>
<% if @shixun.can_copy && User.current.logged? %>
<div href="javascript:void(0)" class="fr user_default_btn user_blue_btn mr20" style="display: flex;">
<% if User.current.mail.blank? %>
<a data-tip-down = "基于这个实训修改形成新的实训"

@ -76,12 +76,12 @@
<span class="delay ml10">延时</span>
<% end %>
</td>
<td><%= game.try(:open_time).nil? ? "--" : format_time(game.open_time) %></td>
<td><%= game.try(:open_time).nil? || game.status == 3 ? "--" : format_time(game.open_time) %></td>
<% user_query = @game_user_query.select{|user_query| user_query[0] == game.id} %>
<td><%= user_query.blank? ? "--" : user_query.first[1] %></td>
<td><%= game.try(:end_time).nil? ? "--" : format_time(game.end_time) %></td>
<td><%= game.consumes_time %></td>
<td><%= game.final_score.to_i < 0 ? 0 : game.challenge.score.to_i %> / <%= game.challenge.st == 1 ? game.challenge.choose_score : game.challenge.score %></td>
<td><%= game.status == 2 ? (game.final_score.to_i < 0 ? 0 : game.challenge.score.to_i) : 0 %> / <%= game.challenge.st == 1 ? game.challenge.choose_score : game.challenge.score %></td>
</tr>
<% end %>
</tbody>

@ -86,6 +86,7 @@
<% end %>
</p>
<% if User.current.logged? %>
<div class="homepagePostSetting" style="right: 4px;top: 5px;display: block">
<ul>
<li class="edu-position edu-position-hidebox">
@ -105,6 +106,8 @@
</li>
</ul>
</div>
<% end %>
</div>
</div>
<% end %>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save