diff --git a/app/controllers/colleges_controller.rb b/app/controllers/colleges_controller.rb index d95fd848..5f1f094c 100644 --- a/app/controllers/colleges_controller.rb +++ b/app/controllers/colleges_controller.rb @@ -1,7 +1,9 @@ # encoding: utf-8 class CollegesController < ApplicationController - before_filter :find_department, :only => [:statistics, :course_statistics, :student_shixun, :engineering_capability, :student_eval] + before_filter :find_department, :only => [:statistics, :course_statistics, :student_shixun, :engineering_capability, + :student_eval, :shixun_time, :shixun_report_count, :teachers, :shixun_chart_data, + :student_hot_evaluations] before_filter :manager_auth, :except => [:home, :get_home_data] include ApplicationHelper @@ -42,81 +44,85 @@ class CollegesController < ApplicationController end def statistics - logger.info("#########################{params}") - @teachers_count = User.find_by_sql("SELECT COUNT(users.`id`) AS teacher_count FROM users LEFT JOIN user_extensions ON users.id=user_extensions.user_id WHERE - user_extensions.`school_id` = #{@school.id} AND user_extensions.`identity` = 0").first.try(:teacher_count) - @students_count = User.find_by_sql("SELECT COUNT(users.`id`) AS student_count FROM users LEFT JOIN user_extensions ON users.id=user_extensions.user_id WHERE - user_extensions.`school_id` = #{@school.id} AND user_extensions.`identity` = 1").first.try(:student_count) - # Redo:这样做内存会卡死的 - # user_ids = User.find_by_sql("SELECT users.id FROM users LEFT JOIN user_extensions ON users.id=user_extensions.user_id WHERE user_extensions.`school_id` = #{@school.id}").map(&:id) - # Redo:是否直接使用count会更好 - all_course_ids = Course.where("id != 1309 and is_delete = 0 and school_id = #{@school.id}") - @courses_count = all_course_ids.size - - # Redo:对于量比较大的尽量不使用笛卡尔积 - # @shixuns_count = Shixun.where(:status => [2, 3], :user_id => user_ids).size - @shixuns_count = Shixun.find_by_sql("select count(s.id) as shixun_count from users u right join shixuns s on u.id=s.user_id and s.status in (2, 3) inner join user_extensions ue on - u.id=ue.user_id and ue.school_id=#{@school.id}").first.try(:shixun_count) - # @shixun_time_sum = (Game.where(:user_id => user_ids).pluck(:cost_time).sum / (24*60*60.0)).ceil - @shixun_time_sum = (Game.find_by_sql("select sum(g.cost_time) cost_time from users u RIGHT join games g on u.id=g.user_id inner join user_extensions ue on - u.id=ue.user_id and ue.school_id=#{@school.id}").first.try(:cost_time).to_i / (24 * 60 * 60.0)).ceil - - # select count(sw.id) from users u left join student_works sw on u.id=sw.user_id and sw.myshixun_id is not null and sw.work_status !=0 inner join user_extensions ue on u.id=ue.user_id and ue.school_id=117 ; - # @shixun_report_count = StudentWork.where("work_status != 0 and user_id in (#{user_ids.join(',').strip == "" ? -1 : user_ids.join(',')}) and myshixun_id is not null").count - @shixun_report_count = StudentWork.find_by_sql("SELECT count(*) as sw_count FROM `student_works` where user_id in (SELECT users.id FROM users RIGHT JOIN user_extensions ON users.id=user_extensions.user_id WHERE - user_extensions.`school_id`=#{@school.id}) and work_status between 1 and 2 and myshixun_id !=0").first.try(:sw_count) + # 教师、学生总数 + count_statistic = UserExtensions.where(school_id: @school.id).select('SUM(IF(identity=0, 1, 0)) AS teachers_count, SUM(IF(identity=1, 1, 0)) AS students_count').first + @teachers_count = count_statistic['teachers_count'] + @students_count = count_statistic['students_count'] + # 课堂总数 + @courses_count = Course.where(school_id: @school.id, is_delete: 0).where('id != 1309').count + # 实训总数 + @shixuns_count = Shixun.visible.joins('left join user_extensions on user_extensions.user_id = shixuns.user_id').where(user_extensions: { school_id: @school.id }).count + + respond_to do |format| + format.html {render :layout => "base_edu"} + end + end + + def shixun_time + time_sum = Game.joins('left join user_extensions on user_extensions.user_id = games.user_id').where(user_extensions: { school_id: @school.id }).sum(:cost_time) + shixun_time_sum = (time_sum / (24 * 60 * 60.0)).ceil + + render json: { shixun_time: shixun_time_sum } + end + + def shixun_report_count + shixun_report_count = StudentWork.where(work_status: [1, 2]).where('myshixun_id != 0') + .joins('left join user_extensions on user_extensions.user_id = student_works.user_id') + .where(user_extensions: { school_id: @school.id }).count + render json: { shixun_report_count: shixun_report_count } + end + + def teachers @teachers = User.find_by_sql("SELECT users.id, users.login, users.lastname, users.firstname, users.nickname, IFNULL((SELECT count(shixuns.id) FROM shixuns where shixuns.user_id =users.id group by shixuns.user_id), 0) AS publish_shixun_count, (SELECT count(c.id) FROM courses c, course_members m WHERE c.id != 1309 and m.course_id = c.id AND m.role in (1,2,3) and c.school_id = #{@school.id} AND m.user_id=users.id AND c.is_delete = 0) as course_count FROM `users`, user_extensions ue where users.id=ue.user_id and ue.identity=0 and ue.school_id=#{@school.id} ORDER BY publish_shixun_count desc, course_count desc, id desc LIMIT 10") # ).order("publish_shixun_count desc, experience desc").limit(10) @teachers = - @teachers.map do |teacher| - course_ids = Course.find_by_sql("SELECT c.id FROM courses c, course_members m WHERE c.id != 1309 and m.course_id = c.id AND m.role in (1,2,3) AND m.user_id=#{teacher.id} AND c.is_delete = 0 and c.school_id = #{@school.id}") - course_count = course_ids.size - homeworks = HomeworkCommon.where(:homework_type => 4, :course_id => course_ids.map(&:id)) - un_shixun_work_count = homeworks.where("publish_time > '#{Time.now}' or publish_time is null").count - shixun_work_count = homeworks.size - un_shixun_work_count - student_count = StudentsForCourse.where(:course_id => course_ids.map(&:id)).count - myshixun_ids = StudentWork.select("myshixun_id").where("homework_common_id in (#{homeworks.map(&:id).join(',').strip == "" ? -1 : homeworks.map(&:id).join(',')}) and myshixun_id is not null") - complete_myshixun = Myshixun.select("id").where(:status => 1, :id => myshixun_ids.map(&:myshixun_id)).size - all_myshixun = Myshixun.select("id").where(:id => myshixun_ids.map(&:myshixun_id)).size - complete_rate = all_myshixun == 0 ? 0 : ((complete_myshixun * 100) / all_myshixun).try(:round, 2).to_f - real_name = teacher.show_real_name - teacher = teacher.attributes.dup.merge({ - real_name: real_name, - course_count: course_count, - shixun_work_count: shixun_work_count, - un_shixun_work_count: un_shixun_work_count, - student_count: student_count, - complete_rate: complete_rate - }).to_json - JSON.parse(teacher) - end - - shixun_ids = HomeworkCommonsShixuns.find_by_sql("SELECT hcs.shixun_id FROM homework_commons_shixuns hcs, homework_commons hc - WHERE hc.course_id in (#{all_course_ids.map(&:id).join(',').strip == "" ? -1 : all_course_ids.map(&:id).join(',')}) - AND hcs.homework_common_id = hc.id").map(&:shixun_id) - shixun_tags = TagRepertoire.find_by_sql("SELECT tr.`name`, COUNT(str.shixun_id) as shixun_count FROM tag_repertoires tr, - shixun_tag_repertoires str WHERE tr.id = str.tag_repertoire_id AND str.shixun_id - IN (#{shixun_ids.join(',').strip == "" ? -1 : shixun_ids.join(',')}) GROUP BY tr.id - order by shixun_count desc") - all_shixun_count = shixun_tags.map(&:shixun_count).sum - other_count = all_shixun_count.to_i - shixun_tags[0..8].map(&:shixun_count).sum.to_i - @shixun_tags_name = [] - @shixun_tags_data = [] - shixun_tags[0..8].each do |tag| - @shixun_tags_name << tag.name - @shixun_tags_data << {value: tag.shixun_count, name: tag.name} - end - if shixun_tags.size > 9 - @shixun_tags_name << 'Others' - @shixun_tags_data << {value: other_count, name: 'Others'} + @teachers.map do |teacher| + course_ids = Course.find_by_sql("SELECT c.id FROM courses c, course_members m WHERE c.id != 1309 and m.course_id = c.id AND m.role in (1,2,3) AND m.user_id=#{teacher.id} AND c.is_delete = 0 and c.school_id = #{@school.id}") + course_count = course_ids.size + homeworks = HomeworkCommon.where(:homework_type => 4, :course_id => course_ids.map(&:id)) + un_shixun_work_count = homeworks.where("publish_time > '#{Time.now}' or publish_time is null").count + shixun_work_count = homeworks.size - un_shixun_work_count + student_count = StudentsForCourse.where(:course_id => course_ids.map(&:id)).count + myshixun_ids = StudentWork.select("myshixun_id").where("homework_common_id in (#{homeworks.map(&:id).join(',').strip == "" ? -1 : homeworks.map(&:id).join(',')}) and myshixun_id is not null") + complete_myshixun = Myshixun.select("id").where(:status => 1, :id => myshixun_ids.map(&:myshixun_id)).size + all_myshixun = Myshixun.select("id").where(:id => myshixun_ids.map(&:myshixun_id)).size + complete_rate = all_myshixun == 0 ? 0 : ((complete_myshixun * 100) / all_myshixun).try(:round, 2).to_f + real_name = teacher.show_real_name + teacher = teacher.attributes.dup.merge({ + real_name: real_name, + course_count: course_count, + shixun_work_count: shixun_work_count, + un_shixun_work_count: un_shixun_work_count, + student_count: student_count, + complete_rate: complete_rate + }).to_json + JSON.parse(teacher) + end + end + + def shixun_chart_data + shixun_ids = HomeworkCommonsShixuns.joins(homework_common: :course).where(courses: {school_id: @school.id, is_delete: 0}).where('courses.id != 1309').pluck('distinct shixun_id') + shixun_count_map = ShixunTagRepertoire.joins(:tag_repertoire).where(shixun_id: shixun_ids).group('tag_repertoires.name').order('count_shixun_id desc').count(:shixun_id) + + names = [] + data = [] + shixun_count_map.each do |name, count| + break if names.size == 9 + + names << name + data << { value: count, name: name } end - respond_to do |format| - format.html {render :layout => "base_edu"} + if shixun_count_map.keys.size > 9 + other_count = shixun_count_map.values[9..-1].reduce(:+) + names << 'Others' + data << { name: 'Others', value: other_count } end + + render json: { names: names, data: data } end # 在线课堂 @@ -152,33 +158,24 @@ class CollegesController < ApplicationController # @courses = Course.where("courses.school_id = #{@department.school_id} and courses.is_delete = 0").select("courses.id, courses.tea_id, courses.name, courses.is_end, # (SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS update_time").order("update_time desc") @courses = paginateHelper @courses, 8 - # @courses = @courses.includes(:student, :boards, :exercises, :polls, :attachments, :homework_commons, :teacher => [:user_extensions]) end # 学生实训 def student_shixun - user_ids = User.find_by_sql("SELECT users.id FROM users, user_extensions WHERE users.id=user_extensions.user_id AND user_extensions.`school_id` = #{@school.id}").map(&:id) - @students = User.find_by_sql("SELECT users.id, users.login, users.lastname, users.firstname, users.nickname, users.grade, - users.experience, ue.student_id, (SELECT COUNT(myshixuns.id) FROM `myshixuns` WHERE myshixuns.user_id - = users.id AND myshixuns.status = 1 GROUP BY users.id) AS myshixun_count FROM users join user_extensions ue on - users.id = ue.user_id where ue.school_id = #{@school.id} AND ue.identity = 1 AND `users`.`type` IN ('User', 'AnonymousUser') ORDER BY experience DESC, myshixun_count DESC LIMIT 10") - - ## outputs基数过大,用inner join有奇效 - @shixun_tags = TagRepertoire.find_by_sql(%Q{ - select name, COUNT(outputs.id) AS test_count from outputs inner join ( - SELECT tr.id as trid, tr.`name` as name, games.id as id - FROM tag_repertoires tr, shixun_tag_repertoires str, games, myshixuns - WHERE tr.id = str.tag_repertoire_id - AND str.shixun_id = myshixuns.`shixun_id` - AND myshixuns.id = games.`myshixun_id` - AND myshixuns.`user_id` IN ( - SELECT users.id FROM users, user_extensions WHERE users.id=user_extensions.user_id AND user_extensions.`school_id` = #{@school.id} - ) - ) a on a.id = outputs.game_id and outputs.`test_set_position` = 1 group by trid - ORDER BY test_count DESC - LIMIT 10 - }) + @students = User.joins(:user_extensions).where(user_extensions: { school_id: @school.id, identity: 1 }).includes(:user_extensions).order('experience desc').limit(10) + + student_ids = @students.map(&:id) + @shixun_count = Myshixun.where(user_id: student_ids).group(:user_id).count + @study_shixun_count = Myshixun.where(user_id: student_ids, status: 0).group(:user_id).count + end + + def student_hot_evaluations + games = Game.joins(:myshixun).joins('join shixun_tag_repertoires str on str.shixun_id = myshixuns.shixun_id') + games = games.joins('join tag_repertoires tr on tr.id = str.tag_repertoire_id') + games = games.joins("join user_extensions ue on ue.user_id = myshixuns.user_id and ue.school_id = #{@school.id}") + evaluate_count_map = games.group('tr.name').reorder('sum_games_evaluate_count desc').limit(10).sum('games.evaluate_count') + render json: { names: evaluate_count_map.keys, values: evaluate_count_map.values } end # 工程能力 diff --git a/app/controllers/competition_teams_controller.rb b/app/controllers/competition_teams_controller.rb index b1d6788e..cfae2acf 100644 --- a/app/controllers/competition_teams_controller.rb +++ b/app/controllers/competition_teams_controller.rb @@ -14,6 +14,10 @@ class CompetitionTeamsController < ApplicationController def show return render_404 if @competition.identifier != 'gcc-course-2019' + end + + def shixun_detail + return render_404 if @competition.identifier != 'gcc-course-2019' @team_user_ids = @team.team_members.pluck(:user_id) @@ -40,13 +44,17 @@ class CompetitionTeamsController < ApplicationController @forked_course_count_map[forked_shixun_map[forked_id]] += course_count end @forked_shixun_map = forked_shixun_map + end + def course_detail + return render_404 if @competition.identifier != 'gcc-course-2019' + + @team_user_ids = @team.team_members.pluck(:user_id) - # 课堂 student_count_subquery = CourseMember.where('course_id = courses.id AND role = 4').select('count(*)').to_sql subquery = StudentWork.where('homework_common_id = hcs.id') - .select('sum(compelete_status !=0 ) as finish, count(*) as total') - .having('total != 0 and finish >= (total / 2)').to_sql + .select('sum(compelete_status !=0 ) as finish, count(*) as total') + .having('total != 0 and finish >= (total / 2)').to_sql course_ids = Course.where('courses.created_at > ?', Time.parse('2018-06-01')) .where('courses.created_at <= ?', @competition.end_time) .where("(#{student_count_subquery}) >= 3") @@ -55,7 +63,7 @@ class CompetitionTeamsController < ApplicationController .where(course_members: { user_id: @team_user_ids }).pluck(:id) courses = Course.where(id: course_ids).joins(:shixun_homework_commons).where('homework_commons.publish_time < now()') @courses = courses.select('courses.id, courses.name, courses.members_count, count(*) shixun_homework_count') - .group('courses.id').order('shixun_homework_count desc').having('shixun_homework_count > 0') + .group('courses.id').order('shixun_homework_count desc').having('shixun_homework_count > 0') course_ids = @courses.map(&:id) @course_myshixun_map = Myshixun.joins(student_works: :homework_common) diff --git a/app/controllers/competitions_controller.rb b/app/controllers/competitions_controller.rb index 57ff871c..cd3a9ef6 100644 --- a/app/controllers/competitions_controller.rb +++ b/app/controllers/competitions_controller.rb @@ -327,9 +327,9 @@ class CompetitionsController < ApplicationController elsif @type == "决赛" # '92b7vt8x','a7fxenvc','wt2xfzny','xa4m9cng','tng6heyf','am5o73er','9fla2zry','fzp3iu4w','qlsy6xb4' # 预赛的实训id 第一阶段:1289,1373,1256 第二阶段:1488, 1453, 1487 第三阶段:1470, 1473, 1408 - shixun1_id = Shixun.where(:identifier => ['92b7vt8x','a7fxenvc','wt2xfzny']).pluck(:id) - shixun2_id = Shixun.where(:identifier => ['xa4m9cng','tng6heyf','am5o73er']).pluck(:id) - shixun3_id = Shixun.where(:identifier => ['9fla2zry','fzp3iu4w','qlsy6xb4']).pluck(:id) + shixun1_id = Shixun.where(:identifier => ['ftlc4x38']).pluck(:id) + shixun2_id = Shixun.where(:identifier => ['y9npgih2','ucqt7fw3','2p7ouzwk']).pluck(:id) + shixun3_id = Shixun.where(:identifier => ['fj49r7xv','gf2cvxfh','cmoxhtbs']).pluck(:id) end if @competition.competition_scores.where(:competition_stage_id => @stage.id).count == 0 @@ -385,7 +385,7 @@ class CompetitionsController < ApplicationController f_score = team.competition_scores.where(:competition_stage_id => final_stage.try(:id)).first # 预赛记录 p_score = team.competition_scores.where(:competition_stage_id => pre_stage.try(:id)).first - team[:s_score] = (f_score.try(:score).to_f * 0.85 + p_score.try(:score).to_f * 0.15).try(:round, 2) + team[:s_score] = (f_score.try(:score).to_f * 0.80 + p_score.try(:score).to_f * 0.20).try(:round, 2) team[:s_spend_time] = f_score.try(:cost_time).to_i + p_score.try(:cost_time).to_i end end diff --git a/app/controllers/ec_graduation_requirements_controller.rb b/app/controllers/ec_graduation_requirements_controller.rb index 091588cd..79c678de 100644 --- a/app/controllers/ec_graduation_requirements_controller.rb +++ b/app/controllers/ec_graduation_requirements_controller.rb @@ -50,9 +50,14 @@ class EcGraduationRequirementsController < ApplicationController @year = requirement.ec_year @template_major = admin_or_business? || @year.ec_major_school.school.ec_school_users.pluck(:user_id).include?(User.current.id) requirement.update_attribute(:content, params[:requirement]) - requirement.ec_graduation_subitems.destroy_all + # requirement.ec_graduation_subitems.destroy_all params[:subitems].try(:each_with_index) do |sub, index| - EcGraduationSubitem.create(:content => sub, :position => index+1, :ec_graduation_requirement_id => requirement.id) + subitem = requirement.ec_graduation_subitems.where(position: index+1).first + if subitem.present? + subitem.update_attributes(:content => sub) + else + EcGraduationSubitem.create(:content => sub, :position => index+1, :ec_graduation_requirement_id => requirement.id) + end end @ec_graduation_requirements = requirement.ec_year.ec_graduation_requirements diff --git a/app/controllers/ec_graduation_subitems_controller.rb b/app/controllers/ec_graduation_subitems_controller.rb index b281e3f3..1248f450 100644 --- a/app/controllers/ec_graduation_subitems_controller.rb +++ b/app/controllers/ec_graduation_subitems_controller.rb @@ -82,9 +82,13 @@ class EcGraduationSubitemsController < ApplicationController # DELETE /ec_graduation_subitems/1.json def destroy @ec_graduation_subitem = EcGraduationSubitem.find(params[:id]) + @ec_graduation_requirement = @ec_graduation_subitem.ec_graduation_requirement + @ec_graduation_requirement.ec_graduation_subitems.where("position > #{@ec_graduation_subitem.position}").update_all("position = position - 1") + @ec_graduation_requirements = @ec_graduation_requirement.ec_year.ec_graduation_requirements @ec_graduation_subitem.destroy respond_to do |format| + format.js format.html { redirect_to ec_graduation_subitems_url } format.json { head :no_content } end diff --git a/app/controllers/ecloud_controller.rb b/app/controllers/ecloud_controller.rb index ac303ce3..3e02c579 100644 --- a/app/controllers/ecloud_controller.rb +++ b/app/controllers/ecloud_controller.rb @@ -18,7 +18,7 @@ class EcloudController < ApplicationController skip_before_filter :verify_authenticity_token before_filter :save_para - # before_filter :check_sign, only: [:ps_new, :ps_update, :bs_new, :bs_update] + before_filter :check_sign, only: [:ps_new, :ps_update, :bs_new, :bs_update] before_filter :user_setup # before_filter :require_login, only: [:authorize] diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index cc896ef2..b766ad07 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -29,7 +29,7 @@ class ManagementsController < ApplicationController end def user_agents - @user_agents = UserAgent.where("user_agents.key is not null") + @user_agents = UserAgent.where("user_agents.key is not order by action_status, register_status") @agents_count = @user_agents.count limit = 20 @agents_pages = Paginator.new @agents_count, limit, params['page'] || 1 @@ -179,6 +179,8 @@ class ManagementsController < ApplicationController if params[:search] if params[:search].to_i.to_s == params[:search].to_s myshixun_id = Game.where(:myshixun_id => params[:search].to_i).pluck(:myshixun_id) + game_myshixun_id = Game.where(:id => params[:search].to_i).pluck(:myshixun_id) + myshixun_id = myshixun_id + game_myshixun_id else myshixun_id = Game.where(:identifier => params[:search]).pluck(:myshixun_id) end @@ -221,7 +223,9 @@ class ManagementsController < ApplicationController @user.admin = params[:admin].to_i end @user.firstname = "" - @user.mail = params[:mail].strip == "" ? nil : params[:mail] + if params[:mail].present? + @user.mail = params[:mail].strip + end @user.phone = params[:phone].strip == "" ? nil : params[:phone] #@user.password = params[:new_password] # if params[:new_password].strip != "" && params[:new_password_confirmation].strip != "" @@ -1742,22 +1746,26 @@ end # 删除 def delete_applied_departments - applied_department = ApplyAddDepartment.find params[:depart_id] - applied_message = AppliedMessage.where(:applied_id => applied_department.id, :applied_type => "ApplyAddDepartment") - applied_message.update_all(:status => 3) - applied_department.update_attribute(:status, 3) - # 未审批删除 - if params[:tip] == "unapplied" - # AppliedMessage.create(:user_id => applied_department.user_id, :status => 3, :viewed => 0, :applied_id => applied_department.id, :applied_type => "ApplyAddDepartment", :name => applied_department.name ) - Tiding.where(:user_id => 1, :trigger_user_id => applied_department.user_id, :container_id => applied_department.id, :container_type => 'ApplyAddDepartment', :status => 0, :tiding_type => "Apply").update_all(:status => 1) - Tiding.create(:user_id => applied_department.user_id, :trigger_user_id => 0, :container_id => applied_department.id, :container_type =>'ApplyAddDepartment', :belong_container_id => applied_department.department.school_id, :belong_container_type=> 'School', :tiding_type => "System", :status => 2, :extra => params[:reason]) - # 删除学校的用户 - users = UserExtensions.where("department_id = #{applied_department.department_id}") - users.update_all(department_id: nil, profile_completed: false) - applied_department.department.destroy - # 已审批删除 - elsif params[:tip] == "applied" - applied_department.destroy + ActiveRecord::Base.transaction do + applied_department = ApplyAddDepartment.find params[:depart_id] + applied_message = AppliedMessage.where(:applied_id => applied_department.id, :applied_type => "ApplyAddDepartment") + applied_message.update_all(:status => 3) + applied_department.update_attribute(:status, 3) + # 未审批删除 + if params[:tip] == "unapplied" + # AppliedMessage.create(:user_id => applied_department.user_id, :status => 3, :viewed => 0, :applied_id => applied_department.id, :applied_type => "ApplyAddDepartment", :name => applied_department.name ) + Tiding.where(:user_id => 1, :trigger_user_id => applied_department.user_id, :container_id => applied_department.id, :container_type => 'ApplyAddDepartment', :status => 0, :tiding_type => "Apply").update_all(:status => 1) + Tiding.create(:user_id => applied_department.user_id, :trigger_user_id => 0, :container_id => applied_department.id, :container_type =>'ApplyAddDepartment', :belong_container_id => applied_department.department.school_id, :belong_container_type=> 'School', :tiding_type => "System", :status => 2, :extra => params[:reason]) + # 删除学校的用户 + user_exs = UserExtensions.where("department_id = #{applied_department.department_id}") + users = User.where(id: user_exs.pluck(:user_id)) + user_exs.update_all(department_id: nil) + users.update_all(profile_completed: false) + applied_department.department.destroy + # 已审批删除 + elsif params[:tip] == "applied" + applied_department.destroy + end end respond_to do |format| format.html{ redirect_to depart_managements_path } @@ -2080,7 +2088,7 @@ end @school_id = params[:school_id] if params[:school_id] && params[:school_id] != '' - @courses = @courses.joins("join user_extensions ue on courses.tea_id = ue.user_id").where("ue.school_id = #{params[:school_id]}") + @courses = @courses.where(school_id: params[:school_id]) end if params[:homepage_show] @@ -2963,7 +2971,7 @@ end member = course.course_members.where(:user_id => user.id, :role => member_role).first # 如果已是课堂成员且是学生身份and不在指定的分班则移动到该分班 if member.present? && member.role == 4 && member.course_group_id != course_group.try(:id).to_i - member.update_column("course_group_id", course_group.try(:id).to_i) + member.update_attributes(course_group_id: course_group.try(:id).to_i) member_count += 1 elsif !member.present? member = CourseMember.new(:role => member_role, :user_id => user.id) @@ -2984,9 +2992,9 @@ end @status = 1 @message = "已导入/更新#{member_count}个成员" end - rescue + rescue Exception => e @status = 0 - @message = "文件内容无法读取" + @message = e.message end else @status = 0 @@ -3028,18 +3036,12 @@ end # 用户不存在则创建账号 if !user.present? && school.present? department = school.departments.where(:name => list[2]).first - user = User.new - user.admin = false - user.activate - user.login = prefix + list[0].to_s.strip - user.lastname = list[1].to_s.strip - user.nickname = list[1].to_s.strip - user.professional_certification = 1 - user.certification = 1 - user.grade = 0 - user.password = "12345678" - user.phone = list[5].blank? ? nil : list[5] - if user.save + user_params = {status: 1, login: prefix + list[0].to_s.strip, lastname: list[1].to_s.strip, + nickname: list[1].to_s.strip, professional_certification: 1, certification: 1, grade: 0, + password: "12345678", phone: list[5].blank? ? nil : list[5], mail: "#{prefix+list[0].to_s.strip}@qq.com", profile_completed: 1} + user = User.create(user_params) + user = User.find(prefix + list[0].to_s.strip) + if user ue = UserExtensions.new(:user_id => user.id, :gender => 0, :school_id => school_id, :location => school.province, :location_city => school.city, :identity => list[3].to_i, :student_id => list[0].to_s.strip, :department_id => department.try(:id)) if list[3] && list[3].to_i == 0 ue.technical_title = ["教授", "副教授", "讲师", "助教"].include?(list[4]) ? list[4] : "讲师" @@ -4202,7 +4204,7 @@ end sheet1[count_row, 5] = show_shixun_mirror(shixun) sheet1[count_row, 6] = shixun.fork_identifier sheet1[count_row, 7] = shixun.challenges.count - sheet1[count_row, 8] = Setting.server_url + shixun_path(shixun) + sheet1[count_row, 8] = Setting.server_url + shixun_path(shixun).sub("/", "") count_row += 1 end book.write xls_report diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 251e6de7..bd850ac6 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -42,7 +42,9 @@ class WelcomeController < ApplicationController # 运营引流个人数据展示 def user_agents - @user_agents = UserAgent.where(key: params[:edu]) + @user_agents = UserAgent.where(key: params[:edu]).order("register_status desc, action_status desc") + @action_count = @user_agents.where(action_status: 2).count + @register_count = @user_agents.where(register_status: 2).count @agents_count = @user_agents.count limit = 20 @agents_pages = Paginator.new @agents_count, limit, params['page'] || 1 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c497cb4e..3a2b0560 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3036,11 +3036,11 @@ module ApplicationHelper elsif @contest title << (@contest.name.nil? ? "创新源于实践" : @contest.name) elsif @shixun - title << (@shixun.name.nil? ? "开发社区" : @shixun.name) + title << (@shixun.name.nil? ? "实训项目" : @shixun.name) elsif @my_shixun - title << ("我的实训") + title << ("我的实训项目") elsif params[:controller] == "shixuns" && params[:action] == "index" - title << ("开发社区") + title << ("实训项目") elsif @subject title << (@subject.name.nil? ? "实践课程" : @subject.name) elsif params[:controller] == "subjects" && params[:action] == "index" diff --git a/app/models/competition_team.rb b/app/models/competition_team.rb index e2551710..a8f48b3e 100644 --- a/app/models/competition_team.rb +++ b/app/models/competition_team.rb @@ -11,7 +11,8 @@ class CompetitionTeam < ActiveRecord::Base # attr_accessible :invite_code, :name, :team_type def teacher - User.where(:id => self.teacher_id).first + teacher_id = self.teachers.first&.user_id + User.where(id: teacher_id).first end def group_members diff --git a/app/models/course_group.rb b/app/models/course_group.rb index c5b66d87..2986e6ac 100644 --- a/app/models/course_group.rb +++ b/app/models/course_group.rb @@ -1,6 +1,6 @@ class CourseGroup < ActiveRecord::Base # attr_accessible :title, :body - belongs_to :course + belongs_to :course, :counter_cache => true has_many :course_members has_many :members has_many :memberships, :class_name => 'Member' diff --git a/app/models/course_member.rb b/app/models/course_member.rb index d67994ef..788f87aa 100644 --- a/app/models/course_member.rb +++ b/app/models/course_member.rb @@ -15,6 +15,7 @@ class CourseMember < ActiveRecord::Base homeworks = course.homework_commons.includes(:homework_detail_manual).where("homework_type in (1, 3, 4)") if homeworks.count != 0 homeworks.each do |hw| + next if hw.student_works.where(user_id: user_id).any? str += "," if str != "" str += "('#{hw.name}的作品提交',#{hw.id},#{user_id}, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')" end @@ -34,6 +35,7 @@ class CourseMember < ActiveRecord::Base exercises = course.exercises if exercises.count != 0 exercises.each do |ex| + next if ex.exercise_users.where(user_id: user_id).any? str += "," if str != "" str += "(#{ex.id},#{user_id}, 0, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')" end @@ -53,6 +55,7 @@ class CourseMember < ActiveRecord::Base polls = course.polls if polls.count != 0 polls.each do |poll| + next if poll.poll_users.where(user_id: user_id).any? str += "," if str != "" str += "(#{poll.id},#{user_id}, 0, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')" end @@ -72,6 +75,7 @@ class CourseMember < ActiveRecord::Base tasks = course.graduation_tasks if tasks.count != 0 tasks.each do |task| + next if task.graduation_works.where(user_id: user_id).any? str += "," if str != "" str += "(#{task.id}, #{user_id}, #{course.id}, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')" end diff --git a/app/models/message.rb b/app/models/message.rb index 9e516acb..91fdefac 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -119,6 +119,10 @@ class Message < ActiveRecord::Base message_detail.try(:content) end + def content + message_detail.try(:content) + end + # def content # self.try(:content) # end diff --git a/app/models/tag_repertoire.rb b/app/models/tag_repertoire.rb index c33faa5c..7b7891e7 100644 --- a/app/models/tag_repertoire.rb +++ b/app/models/tag_repertoire.rb @@ -1,8 +1,8 @@ class TagRepertoire < ActiveRecord::Base # attr_accessible :title, :body belongs_to :sub_repertoire - has_many :shixuns, :through => :shixun_tag_repertoires has_many :shixun_tag_repertoires, :dependent => :destroy + has_many :shixuns, :through => :shixun_tag_repertoires has_many :memos, :through => :memo_tag_repertoires has_many :memo_tag_repertoires, :dependent => :destroy diff --git a/app/models/user.rb b/app/models/user.rb index dbb77124..58f293d6 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -300,7 +300,7 @@ class User < Principal attr_accessor :password, :password_confirmation attr_accessor :last_before_login_on # Prevents unauthorized assignments - attr_protected :login, :admin, :password, :password_confirmation, :hashed_password + # attr_protected :login, :admin, :password, :password_confirmation, :hashed_password LOGIN_LENGTH_LIMIT = 30 MAIL_LENGTH_LIMIT = 60 @@ -308,15 +308,15 @@ class User < Principal #validates_presence_of :login, :mail, :if => Proc.new { |user| !user.is_a?(AnonymousUser) } validates_presence_of :login, :if => Proc.new { |user| !user.is_a?(AnonymousUser) } validates_uniqueness_of :login, :if => Proc.new { |user| user.login_changed? && user.login.present? }, :case_sensitive => false - validates_uniqueness_of :mail, :if => Proc.new { |user| user.mail_changed? && user.mail.present? }, :case_sensitive => false + #validates_uniqueness_of :mail, :if => Proc.new { |user| user.mail_changed? && user.mail.present? }, :case_sensitive => false validates_uniqueness_of :phone, :if => Proc.new { |user| user.phone_changed? && user.phone.present? }, :case_sensitive => false # Login must contain letters, numbers, underscores only #validates_format_of :login, :with => /\A[a-z0-9_\-]*\z/i validates_length_of :login, :maximum => LOGIN_LENGTH_LIMIT validates_length_of :firstname, :maximum => 30 validates_length_of :lastname, :maximum => 30 - validates_format_of :mail, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, :allow_blank => true - validates_length_of :mail, :maximum => MAIL_LENGTH_LIMIT, :allow_nil => true + #validates_format_of :mail, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, :allow_blank => true + #validates_length_of :mail, :maximum => MAIL_LENGTH_LIMIT, :allow_nil => true validates_confirmation_of :password, :allow_nil => true # validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true validate :validate_password_length @@ -673,9 +673,9 @@ class User < Principal base_reload(*args) end - def mail=(arg) - write_attribute(:mail, arg.to_s.strip) - end + # def mail=(arg) + # write_attribute(:mail, arg.to_s.strip) + # end def identity_url=(url) if url.blank? diff --git a/app/views/colleges/_student_shixun.html.erb b/app/views/colleges/_student_shixun.html.erb index f0999075..5fd310d1 100644 --- a/app/views/colleges/_student_shixun.html.erb +++ b/app/views/colleges/_student_shixun.html.erb @@ -21,8 +21,8 @@ <%= student.show_real_name %> <%= student.student_id %> - <%= student.myshixun_count %> - <%= student.myshixuns.where(:status => 0).count %> + <%= @shixun_count.fetch(student.id, 0) %> + <%= @study_shixun_count.fetch(student.id, 0) %> <%= student.grade %> <%= student.experience %> @@ -32,14 +32,15 @@ @@ -55,7 +55,13 @@ for(var i=0;i确定' pop_box_new(html, 500, 205); } - }) + }); $("input[name='subitems[]'],input[name='requirement']").live("input",function(){ $(this).removeClass("bor-red"); @@ -101,18 +107,18 @@ '

' + '' + ''+liNum+''+ - ''+ + ''+ ''+ ''+ '

'+ '

* '+liNum+'-1'+ - ''+ + ''+ '

'+ '

* '+liNum+'-2'+ - ''+ + ''+ '

'+ '

* '+liNum+'-3'+ - ''+ + ''+ '

'+ '

内容不能为空'+ '保存'+ @@ -121,6 +127,11 @@ ''; $(".ListTableLine").append(html); $("#requirementNew").find("input[name='requirement']").focus(); + var subInputs=document.getElementsByName("subitems[]"); + for (var i = 0; i < subInputs.length; i++) { + autoTextarea(subInputs[i], 0, 140); + } + autoTextarea(document.getElementsByName("requirement")[0], 0, 140); flagAdd=false; } @@ -128,8 +139,8 @@ //取消添加 function removePanel(value){ if(value!=undefined){ - $("#"+value).html($("#editFormContent").html()); - $("#editFormContent").remove(); + $("#"+value).show(); + // $("#editFormContent").remove(); } $("#form_data_for_requirements").remove(); flagAdd=true; @@ -141,9 +152,9 @@ console.log("#########type:"+ type) console.log("#########url:"+ url) - var requirement = $("input[name='requirement']").val(); + var requirement = $("textarea[name='requirement']").val(); if(requirement.trim() == ""){ - $("input[name='requirement']").addClass("bor-red"); + $("textarea[name='requirement']").addClass("bor-red"); $("#option_Item_notice").removeClass("none").html("内容不能为空"); return; } @@ -170,7 +181,7 @@ } }) console.log(in_vain); - $("input[name='requirement']").removeClass("bor-red"); + $("textarea[name='requirement']").removeClass("bor-red"); $("input[name='subitems[]']").removeClass("bor-red"); $("#option_Item_notice").addClass("none"); } diff --git a/app/views/ecs/_ec_top_navigation.html.erb b/app/views/ecs/_ec_top_navigation.html.erb index 40f3b50e..c9e0a0ed 100644 --- a/app/views/ecs/_ec_top_navigation.html.erb +++ b/app/views/ecs/_ec_top_navigation.html.erb @@ -58,7 +58,7 @@ " href="<%= requirement_vs_courses_ec_major_school_ec_year_path(@year, :ec_major_school_id => @year.ec_major_school_id) %>">课程体系 vs 毕业要求

  • - 7 + 8 达成度评价结果
  • \ No newline at end of file diff --git a/app/views/files/_tool_settings.html.erb b/app/views/files/_tool_settings.html.erb index ccce43b0..577030f8 100644 --- a/app/views/files/_tool_settings.html.erb +++ b/app/views/files/_tool_settings.html.erb @@ -3,17 +3,18 @@ <% if User.current.admin? || (User.current.logged? ) %> <% if User.current.admin? || ((is_project_manager?(User.current, project) || file.author_id == User.current.id) && project_contains_attachment?(project, file)) %> <% if User.current.admin? || ((delete_allowed || User.current.id == file.author_id) && file.container_id == project.id && file.container_type == "Project") %> + + <% end %> <% else %> - + + + <%# if hidden_unproject_infos %> + + <%# else %> + + <%# end %> + + <% end %> <% end %> diff --git a/app/views/layouts/_logined_force_header.html.erb b/app/views/layouts/_logined_force_header.html.erb index a161e7d5..e65743c4 100644 --- a/app/views/layouts/_logined_force_header.html.erb +++ b/app/views/layouts/_logined_force_header.html.erb @@ -37,7 +37,7 @@
  • 我的主页
  • 我的课程
  • -
  • 我的实训
  • +
  • 我的实训项目
  • 我的留言
  • 账户管理
  • diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index 66fc345d..e171b517 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -1,13 +1,13 @@ -<%= link_to image_tag("/images/educoder/headNavLogo.png", alt:"高校智能化教学与实训平台", class:"logoimg fl ml25 mr60"), home_path %> +<%= link_to image_tag("/images/educoder/headNavLogo.png", alt:"高校智能化教学与实训平台", class:"logoimg fl mr30 ml25 mt10"), home_path %>
      -
    • "><%= link_to "首页", home_path %>
    • +
    • "><%= link_to "实践课程", subjects_path %>
    • "><%= link_to "翻转课堂", courses_path %>
    • -
    • "><%= link_to "开发社区", shixuns_path %>
    • +
    • "><%= link_to "实训项目", shixuns_path %>
    • <% careers = Career.published.order("created_at asc") %> <% if careers.present? %> @@ -49,7 +49,7 @@ display: none; right:110px;">
    - + @@ -59,15 +59,14 @@ display: none; right:110px;"> <%= link_to (image_tag(url_to_avatar(User.current), :width =>"34", :height => "34", :class => "radius mt13", :nhname => "avatar_image", :alt=>"头像", :id => "nh_user_logo")), user_path(User.current),:class => "fl" %>
    diff --git a/app/views/layouts/_public_left_info.html.erb b/app/views/layouts/_public_left_info.html.erb index 29e9ede5..0ff6fd66 100644 --- a/app/views/layouts/_public_left_info.html.erb +++ b/app/views/layouts/_public_left_info.html.erb @@ -16,7 +16,7 @@ 项目 @@ -37,12 +37,12 @@
    实训
    @@ -112,6 +112,6 @@ // 新建实训 function shixun_valication(){ - sure_box_redirect_btn('<%= security_settings_path %>', '新建实训,请先绑定邮箱','绑定邮箱'); + sure_box_redirect_btn('<%= security_settings_path %>', '新建实训项目,请先绑定邮箱','绑定邮箱'); } \ No newline at end of file diff --git a/app/views/layouts/_unlogin_header.html.erb b/app/views/layouts/_unlogin_header.html.erb index 2e12a992..9875099d 100644 --- a/app/views/layouts/_unlogin_header.html.erb +++ b/app/views/layouts/_unlogin_header.html.erb @@ -1,15 +1,15 @@ -<%= link_to image_tag("/images/educoder/headNavLogo.png", alt:"高校智能化教学与实训平台", class:"logoimg fl ml25 mr60 "), home_path %> +<%= link_to image_tag("/images/educoder/headNavLogo.png", alt:"高校智能化教学与实训平台", class:"logoimg fl mr30 ml25 mt10"), home_path %>
      -
    • "><%= link_to "首页", home_path %>
    • +
    • "><%= link_to "实践课程", subjects_path %>
    • "><%= link_to "翻转课堂", courses_path %>
    • -
    • "><%= link_to "开发社区", shixuns_path %>
    • +
    • "><%= link_to "实训项目", shixuns_path %>
    • <% careers = Career.published.order("created_at asc") %> <% if careers.present? %> @@ -47,7 +47,7 @@
    - + @@ -71,13 +71,13 @@
      -
    • <%= link_to "新建实训", signin_path %>
    • +
    • <%= link_to "新建实训项目", signin_path %>
    • <%= link_to "新建实践课程", signin_path %>
    • -
    • <%= link_to "新建项目", signin_path %>
    • +
    • <%= link_to "新建开发项目", signin_path %>
      -
    • <%= link_to "加入课堂", signin_path %>
    • -
    • <%= link_to "加入项目", signin_path %>
    • +
    • <%= link_to "加入翻转课堂", signin_path %>
    • +
    • <%= link_to "加入开发项目", signin_path %>
    diff --git a/app/views/layouts/base_project_community.html.erb b/app/views/layouts/base_project_community.html.erb index e1e0b7ef..5e9d167a 100644 --- a/app/views/layouts/base_project_community.html.erb +++ b/app/views/layouts/base_project_community.html.erb @@ -56,10 +56,10 @@ <% if is_current_user %>
  • - <%= link_to "新建项目", new_project_path(:host=> Setting.host_name), :target => "_blank", :style => "font-size:14px;" %> + <%= link_to "新建开发项目", new_project_path(:host=> Setting.host_name), :target => "_blank", :style => "font-size:14px;" %>
  • - <%= link_to "加入项目", applied_join_project_path, :remote => true, :method => "post", :style => "font-size:14px;" %> + <%= link_to "加入开发项目", applied_join_project_path, :remote => true, :method => "post", :style => "font-size:14px;" %>
  • <%= link_to "我发布的issue", user_manage_issues_user_path(@user), :target => "_blank", :style => "font-size:14px;" %> diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 7baa3d3b..e0834667 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -23,7 +23,7 @@
    <%= render :partial => User.current.logged? ? 'layouts/logined_header' : 'layouts/unlogin_header' %>
    -
    +
    <%= render :partial => 'layouts/base_project_top' %>
    diff --git a/app/views/layouts/new_base_user_show.html.erb b/app/views/layouts/new_base_user_show.html.erb index 1b767d00..760eb944 100644 --- a/app/views/layouts/new_base_user_show.html.erb +++ b/app/views/layouts/new_base_user_show.html.erb @@ -208,10 +208,10 @@
  • <% if is_current_user %>
  • - 新建项目 + 新建开发项目
  • - 加入项目 + 加入开发项目
  • diff --git a/app/views/managements/_myshixun_list.html.erb b/app/views/managements/_myshixun_list.html.erb index bfcf3dc1..3d68f26f 100644 --- a/app/views/managements/_myshixun_list.html.erb +++ b/app/views/managements/_myshixun_list.html.erb @@ -13,7 +13,7 @@ <% @myshixuns.each do |myshixun| %> <% edu_giturl = "...." %> - <% gitlab_giturl = @g.project(myshixun.gpid).try(:http_url_to_repo) %> + <% gitlab_giturl = "https://git.educoder.net/#{myshixun.repo_name}.git" %> <%= myshixun.id %> <%= link_to myshixun.shixun.try(:name), myshixun_path(myshixun), :target => "_blank", :title => myshixun.shixun.try(:name) %> diff --git a/app/views/managements/_shixun_setting_list.html.erb b/app/views/managements/_shixun_setting_list.html.erb index 98c3deae..bfe4f6c3 100644 --- a/app/views/managements/_shixun_setting_list.html.erb +++ b/app/views/managements/_shixun_setting_list.html.erb @@ -57,7 +57,7 @@ <% @shixun_tags.each do |tag| %>

    data-shixun="<%= shixun.id %>" type="checkbox" class="select<%= count %> magic-checkbox" id="<%= count %>_<%= tag.name %>_<%= tag.id %>" value="<%= tag.name %>"/> - +

    <% end %> diff --git a/app/views/managements/_user_agent_list.html.erb b/app/views/managements/_user_agent_list.html.erb index 43886c8d..6b47e51c 100644 --- a/app/views/managements/_user_agent_list.html.erb +++ b/app/views/managements/_user_agent_list.html.erb @@ -4,9 +4,9 @@ 代理人登录名 代理人姓名 学校 + 用户注册状态 竞赛报名状态 ip - ip 负责人 @@ -19,9 +19,10 @@ <%= link_to ua.key, user_path(ua.key), :target => "_blank" %> <%= link_to user.try(:show_real_name), user_path(user), target:'_blank' %> <%= school.name %> - <%= "--" %> + <%= ua.action_status == 2 ? "代理之后注册" : "--" %> + <%= ua.register_status == 2 ? "代理之后报名" : "--" %> <%= ua.ip %> - <%= "理由" %> + "--" <% end %> diff --git a/app/views/managements/user_agents.html.erb b/app/views/managements/user_agents.html.erb index d29e7bec..a1e88ef0 100644 --- a/app/views/managements/user_agents.html.erb +++ b/app/views/managements/user_agents.html.erb @@ -1,19 +1,10 @@ -<%= form_tag(url_for(departments_part_managements_path),:id=>"department_part_search",:method => "post",:remote=>true) do %> -
    - - 搜索 - 清除 - <%= link_to "关联代理人",add_departments_part_managements_path(),:class => "task-btn task-btn-green fr mt6 mr30" %> - -
    -<% end %>
    <%= render :partial => "managements/user_agent_list" %>
    \ No newline at end of file diff --git a/app/views/managements/video_applies/_video_apply_list.html.erb b/app/views/managements/video_applies/_video_apply_list.html.erb index d3cfc50d..b79cabc4 100644 --- a/app/views/managements/video_applies/_video_apply_list.html.erb +++ b/app/views/managements/video_applies/_video_apply_list.html.erb @@ -22,6 +22,7 @@
  • <%= video.title %> + <%= number_to_human_size(video.filesize) %>
  • <% if apply.pending? %> @@ -58,20 +59,22 @@ \ No newline at end of file diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index 0e9f3d79..314c755f 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -47,7 +47,7 @@ <% end%>
    <% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1%> - 系统提示:该作业要求各组长<%=link_to "创建项目", "https://www.trustie.net/projects/new",:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合! + 系统提示:该作业要求各组长<%=link_to "创建开发项目", "https://www.trustie.net/projects/new",:class=>"c_red",:title=>"新建开发项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合! <% elsif activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 0%> 系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合! <% end %> diff --git a/app/views/projects/new.html.erb b/app/views/projects/new.html.erb index 9cf8ed12..78acf6c6 100644 --- a/app/views/projects/new.html.erb +++ b/app/views/projects/new.html.erb @@ -10,7 +10,7 @@
    -

    新建项目

    +

    新建开发项目

    <%= l(:label_projects_new_name) %>

    diff --git a/app/views/student_work/_new_project.html.erb b/app/views/student_work/_new_project.html.erb index 3d9214c7..0d69382d 100644 --- a/app/views/student_work/_new_project.html.erb +++ b/app/views/student_work/_new_project.html.erb @@ -1,6 +1,6 @@
    <%= labelled_form_for(Project.new,:remote => "true") do |f| %> -

    新建项目

    +

    新建开发项目

    diff --git a/app/views/subjects/_course_shixun_list.html.erb b/app/views/subjects/_course_shixun_list.html.erb index af409ec1..9cc13588 100644 --- a/app/views/subjects/_course_shixun_list.html.erb +++ b/app/views/subjects/_course_shixun_list.html.erb @@ -59,7 +59,7 @@ function newshixuns(mail){ if(mail){ - sure_box_redirect_btn('<%= security_settings_path %>', '新建实训,请先绑定邮箱','绑定邮箱'); + sure_box_redirect_btn('<%= security_settings_path %>', '新建实训项目,请先绑定邮箱','绑定邮箱'); }else{ var a = $("Apple").get(0); diff --git a/app/views/subjects/_new_shixun_list.html.erb b/app/views/subjects/_new_shixun_list.html.erb index 17aafc08..0693b13c 100644 --- a/app/views/subjects/_new_shixun_list.html.erb +++ b/app/views/subjects/_new_shixun_list.html.erb @@ -83,7 +83,7 @@ function newshixuns(mail){ if(mail){ - sure_box_redirect_btn('<%= security_settings_path %>', '新建实训,请先绑定邮箱','绑定邮箱'); + sure_box_redirect_btn('<%= security_settings_path %>', '新建实训项目,请先绑定邮箱','绑定邮箱'); }else{ var a = $("Apple").get(0); diff --git a/app/views/users/_l_shixun.html.erb b/app/views/users/_l_shixun.html.erb index 2b65ab07..f6575ea5 100644 --- a/app/views/users/_l_shixun.html.erb +++ b/app/views/users/_l_shixun.html.erb @@ -54,7 +54,7 @@
    - 新建实训 + 新建实训项目
    diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 1434fe5b..156d3d53 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -23,7 +23,7 @@
    <% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1%> - 系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"linkBlue",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合! + 系统提示:该作业要求各组长<%=link_to "创建开发项目", new_project_path(:host=>Setting.host_name),:class=>"linkBlue",:title=>"新建开发项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合! <% elsif homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 0%> 系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合! <% end %> diff --git a/app/views/users/shixuns.html.erb b/app/views/users/shixuns.html.erb index 4c709872..d36950d1 100644 --- a/app/views/users/shixuns.html.erb +++ b/app/views/users/shixuns.html.erb @@ -1,6 +1,6 @@

    <%= @user.show_real_name %> > - 精选实训 > 我的实训

    + 精选实训 > 我的实训项目

    @@ -45,7 +45,7 @@ // 新建实训 function shixun_new(mail){ if(mail){ - sure_box_redirect_btn('<%= security_settings_path %>', '新建实训,请先绑定邮箱','绑定邮箱'); + sure_box_redirect_btn('<%= security_settings_path %>', '新建实训项目,请先绑定邮箱','绑定邮箱'); }else{ window.location.href= '<%= new_shixun_path %>'; } diff --git a/app/views/users/user_projects.html.erb b/app/views/users/user_projects.html.erb index 009bfe6a..667bf388 100644 --- a/app/views/users/user_projects.html.erb +++ b/app/views/users/user_projects.html.erb @@ -1,7 +1,7 @@
    <% if @user.allowed_to?(:add_project, nil, :global => true) %> - 新建项目 + 新建开发项目 <% end %>
    diff --git a/app/views/welcome/_no_data.html.erb b/app/views/welcome/_no_data.html.erb index e3576008..a37aa535 100644 --- a/app/views/welcome/_no_data.html.erb +++ b/app/views/welcome/_no_data.html.erb @@ -1,4 +1,5 @@ -
    +<% style ||= '' %> +

    暂无数据哦~

    \ No newline at end of file diff --git a/app/views/welcome/_user_agent_list.html.erb b/app/views/welcome/_user_agent_list.html.erb index 607392bd..a4b048f6 100644 --- a/app/views/welcome/_user_agent_list.html.erb +++ b/app/views/welcome/_user_agent_list.html.erb @@ -1,6 +1,6 @@ - + diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index f7a6dbc4..29370db3 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -69,7 +69,7 @@
    -

    开发社区

    +

    实训项目

    DEVELOPMENT COMMUNITY

    更多 diff --git a/app/views/welcome/user_agents.html.erb b/app/views/welcome/user_agents.html.erb index 4fe6649c..f81c537e 100644 --- a/app/views/welcome/user_agents.html.erb +++ b/app/views/welcome/user_agents.html.erb @@ -1,7 +1,6 @@
    - 统计总计: - 引流总人数<%= @agents_count %>人, + 引流总人数:<%= @agents_count %>人 | 竞赛成功报名:<%= @action_count %>
    diff --git a/config/routes.rb b/config/routes.rb index 22ea0bc4..f1d690c7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -283,6 +283,8 @@ RedmineApp::Application.routes.draw do ## oauth相关 resources :competition_teams do member do get 'exit_team' + get 'shixun_detail' + get 'course_detail' end collection do @@ -1008,6 +1010,11 @@ RedmineApp::Application.routes.draw do ## oauth相关 get 'student_eval' get 'home' get 'get_home_data' + get 'shixun_time' + get 'shixun_report_count' + get 'teachers' + get 'shixun_chart_data' + get 'student_hot_evaluations' end collection do diff --git a/db/migrate/20190906014148_migrate_delete_department.rb b/db/migrate/20190906014148_migrate_delete_department.rb new file mode 100644 index 00000000..32a84b44 --- /dev/null +++ b/db/migrate/20190906014148_migrate_delete_department.rb @@ -0,0 +1,16 @@ +class MigrateDeleteDepartment < ActiveRecord::Migration + def up + ApplyAddDepartment.where("status= 3 and created_at > '2019-07-25 00:00:00'").each do |apply| + if apply.department.present? && !apply.department.is_auth + user_exs = UserExtensions.where("department_id = #{apply.department_id}") + users = User.where(id: user_exs.pluck(:user_id)) + user_exs.update_all(department_id: nil) + users.update_all(profile_completed: false) + apply.department.destroy + end + end + end + + def down + end +end diff --git a/public/assets/wechat/new_project.html b/public/assets/wechat/new_project.html index 103651ef..eedd0a9c 100644 --- a/public/assets/wechat/new_project.html +++ b/public/assets/wechat/new_project.html @@ -1,7 +1,7 @@
    -
    新建项目
    +
    新建开发项目
    项目名称
    完成 diff --git a/public/assets/wechat/project_list.html b/public/assets/wechat/project_list.html index d9313b6a..b92e69ab 100644 --- a/public/assets/wechat/project_list.html +++ b/public/assets/wechat/project_list.html @@ -29,8 +29,8 @@ diff --git a/public/images/educoder/headNavLogo.png b/public/images/educoder/headNavLogo.png index 436d2349..8df93d54 100644 Binary files a/public/images/educoder/headNavLogo.png and b/public/images/educoder/headNavLogo.png differ diff --git a/public/javascripts/attachments.js b/public/javascripts/attachments.js index 0275558c..ba201074 100644 --- a/public/javascripts/attachments.js +++ b/public/javascripts/attachments.js @@ -502,8 +502,11 @@ function imageAddInputFiles(inputEl){ addInputFiles(inputEl) } -function addInputFiles(inputEl,btnId) { +function addInputFiles(inputEl,btnId) { // var clearedFileInput = $(inputEl).clone().val(''); + if($("#ajax-indicator").length>0){ + $("#ajax-indicator").show(); + } if (inputEl.files) { // if(inputEl.files.length >= 5){ // alert('一次选择的文件不能超过5个') @@ -527,6 +530,9 @@ function addInputFiles(inputEl,btnId) { if (count <= 0) count = 1; $('#upload_file_count').html("" + count + "" + $(inputEl).data('fileCount')); } + if($("#ajax-indicator").length>0){ + $("#ajax-indicator").hide(); + } } //clearedFileInput.insertAfter('#attachments_fields'); @@ -605,6 +611,9 @@ function uploadAndAttachFiles(files, inputEl,btnId) { addFile(inputEl, this, true,btnId); }); } + if($("#ajax-indicator").length>0){ + $("#ajax-indicator").hide(); + } } function uploadAndAttachFiles_board(files, inputEl, id,btnId) { diff --git a/public/javascripts/init_KindEditor.js b/public/javascripts/init_KindEditor.js index 76c02b44..2442031d 100644 --- a/public/javascripts/init_KindEditor.js +++ b/public/javascripts/init_KindEditor.js @@ -45,21 +45,21 @@ function nh_check_field(params){ if(params.content.isEmpty()){ result=false; } - if(params.content.html()!=params.textarea.html() || params.issubmit==true){ - params.textarea.html(params.content.html()); - params.content.sync(); - if(params.content.isEmpty()){ - params.contentmsg.html('内容不能为空'); - params.contentmsg.css({color:'#ff0000'}); - params.submit_btn.one('click', function(){ - params.form.submit(); - }); - }else{ - params.contentmsg.html('填写正确'); - params.contentmsg.css({color:'#008000'}); - } - params.contentmsg.show(); - } + // if(params.content.html()!=params.textarea.html() || params.issubmit==true){ + // params.textarea.html(params.content.html()); + // params.content.sync(); + // if(params.content.isEmpty()){ + // params.contentmsg.html('内容不能为空'); + // params.contentmsg.css({color:'#ff0000'}); + // params.submit_btn.one('click', function(){ + // params.form.submit(); + // }); + // }else{ + // params.contentmsg.html('填写正确'); + // params.contentmsg.css({color:'#008000'}); + // } + // params.contentmsg.show(); + // } } return result; } diff --git a/public/javascripts/init_activity_KindEditor.js b/public/javascripts/init_activity_KindEditor.js index 4c63d169..3e44c5f0 100644 --- a/public/javascripts/init_activity_KindEditor.js +++ b/public/javascripts/init_activity_KindEditor.js @@ -80,18 +80,18 @@ function nh_check_field(params){ if(params.content.isEmpty()){ result=false; } - if(params.content.html()!=params.textarea.html() || params.issubmit==true){ - params.textarea.html(params.content.html()); - params.content.sync(); - if(params.content.isEmpty() || /^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(params.textarea.html())){ - params.contentmsg.html('内容不能为空'); - params.contentmsg.css({color:'#ff0000'}); - }else{ - params.contentmsg.html('填写正确'); - params.contentmsg.css({color:'#008000'}); - } - params.contentmsg.show(); - } + // if(params.content.html()!=params.textarea.html() || params.issubmit==true){ + // params.textarea.html(params.content.html()); + // params.content.sync(); + // if(params.content.isEmpty() || /^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(params.textarea.html())){ + // params.contentmsg.html('内容不能为空'); + // params.contentmsg.css({color:'#ff0000'}); + // }else{ + // params.contentmsg.html('填写正确'); + // params.contentmsg.css({color:'#008000'}); + // } + // params.contentmsg.show(); + // } } return result; } diff --git a/public/react/src/index.js b/public/react/src/index.js index 55cebf17..98130846 100644 --- a/public/react/src/index.js +++ b/public/react/src/index.js @@ -41,7 +41,7 @@ var proxy = "http://localhost:3000" // proxy = "http://testbdweb.trustie.net" // proxy = "http://testbdweb.educoder.net" // proxy ="http://192.168.2.63:3000" - proxy='http://120.27.231.56:48080' + proxy='http://47.96.87.25:48080' const requestMap={}; // 在这里使用requestMap控制,避免用户通过双击等操作发出重复的请求; // 如果需要支持重复的请求,考虑config里面自定义一个allowRepeat参考来控制 diff --git a/public/react/src/modules/ShCommunity/CommunityHome.js b/public/react/src/modules/ShCommunity/CommunityHome.js index dc86f23a..7866a0d8 100644 --- a/public/react/src/modules/ShCommunity/CommunityHome.js +++ b/public/react/src/modules/ShCommunity/CommunityHome.js @@ -66,7 +66,9 @@ class CommunityHome extends Component { } let xhslist=["路由交换","H3CNA","H3CNE","H3CSE-Routing&Switching","H3CTE","","","H3CNE-SDN","","H3CIE-Routing&SWitching"] return ( -
    +
    ID序号 代理人登录名 代理人姓名 注册情况