diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index c3333c912..0d32926e4 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -83,7 +83,6 @@ class AccountsController < ApplicationController email = params[:login] verifi_code = VerificationCode.where(email: email, code: code, code_type: 3).last user = User.find_by_mail(email) #这里有问题,应该是为email,而不是mail 6.13-hs - end check_code = (verifi_code.try(:code) == code.strip && (Time.now.to_i - verifi_code.created_at.to_i) <= 10*60) unless check_code diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 4a9220939..afe2129a9 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -23,6 +23,13 @@ class ApplicationController < ActionController::Base EduSetting.get(name) end + # 实训的访问权限 + def shixun_access_allowed + if !current_user.shixun_permission(@shixun) + tip_exception(403, "..") + end + end + def user_course_identity @user_course_identity = current_user.course_identity(@course) if @user_course_identity > Course::STUDENT && @course.is_public == 0 diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index f2a964c8d..2ba76c60a 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -5,8 +5,10 @@ class ChallengesController < ApplicationController before_action :find_challenge, only: [:edit, :show, :update, :create_choose_question, :index_down, :index_up, :edit_choose_question, :show_choose_question, :destroy_challenge_choose, :update_choose_question, :destroy, :crud_answer, :answer] - # before_action :allowed, except: [:index, :show, :edit_choose_question, :edit] - + # 关卡更新和操作的权限控制 + before_action :update_allowed, except: [:index] + # 关卡访问的权限控制 + before_action :shixun_access_allowed, only: [:index] include ShixunsHelper include ChallengesHelper @@ -149,7 +151,9 @@ class ChallengesController < ApplicationController def index uid_logger("identifier: #{params}") # 通过调试发现 这里includes(:games)性能会慢10倍 - @challenges = @shixun.challenges.fields_for_list + + @challenges = @shixun.challenges.fields_for_list.includes(:games).where("games.user_id" => current_user.id) + @editable = current_user.manager_of_shixun?(@shixun) && @shixun.status == 0 @user = current_user end @@ -247,7 +251,6 @@ class ChallengesController < ApplicationController # 关卡位置被修改,需要修改脚本 script = modify_shixun_script @shixun, @shixun.evaluate_script @shixun.update_column(:evaluate_script, script) - end def index_up @@ -276,6 +279,9 @@ class ChallengesController < ApplicationController def find_shixun @shixun = Shixun.find_by_identifier(params[:shixun_identifier]) + if !current_user.shixun_permission(@shixun) + tip_exception(403, "..") + end end # 通用接口 @@ -295,9 +301,8 @@ class ChallengesController < ApplicationController :standard_answer, :score, :difficult) end - def allowed - # 实训为发布前,除实训的管理者外,其他人都不人都不允许访问 - if !current_user.manager_of_shixun?(@shixun) && (@shixun.status < 1 || @shixun.hidden == 1) + def update_allowed + unless current_user.manager_of_shixun?(@shixun) raise Educoder::TipException.new(403, "..") end end diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 253bafa48..93eba89d8 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -11,7 +11,7 @@ class CoursesController < ApplicationController render_error(ex.model.errors.full_messages.join(',')) end - before_action :require_login, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups] + before_action :require_login, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups, :left_banner, :top_banner] before_action :set_course, :user_course_identity, only: [:show, :update, :destroy, :settings, :set_invite_code_halt, :set_public_or_private, :search_teacher_candidate, :teachers, :top_banner, :left_banner, :add_teacher_popup, :add_teacher, diff --git a/app/controllers/discusses_controller.rb b/app/controllers/discusses_controller.rb index 6e9c1427e..1d3b524f4 100644 --- a/app/controllers/discusses_controller.rb +++ b/app/controllers/discusses_controller.rb @@ -7,9 +7,18 @@ class DiscussesController < ApplicationController page = params[:page].to_i offset = page * LIMIT # 总数,分页使用 - @disscuss_count = Discuss.where(:dis_id => @container.id, :dis_type => @container.class.to_s, :root_id => nil).count - @discusses = Discuss.limit(LIMIT).where(:dis_id => @container.id, :dis_type => @container.class.to_s, :root_id => nil). - includes(:user, :praise_tread).offset(offset) + if current_user.admin? + @disscuss_count = Discuss.where(:dis_id => @container.id, :dis_type => @container.class.to_s, :root_id => nil).count + @discusses = Discuss.limit(LIMIT).where(:dis_id => @container.id, :dis_type => @container.class.to_s, + :root_id => nil).includes(:user, :praise_tread).offset(offset) + else + disscusses = Discuss.where("dis_id = :dis_id and dis_type = :dis_type and root_id is null and + (hidden = :hidden or user_id = :user_id)", + {dis_id: @container.id, dis_type: @container.class.to_s, hidden: false, user_id: current_user.id}) + @disscuss_count = disscusses.count + @discusses = disscusses.limit(LIMIT).includes(:user, :praise_tread).offset(offset) + end + @current_user = current_user end @@ -23,8 +32,10 @@ class DiscussesController < ApplicationController def create begin - @discuss = Discuss.create!(:dis_id => params[:container_id], :dis_type => params[:container_type], :content => params[:content].gsub(" \;", "").strip, - :user_id => current_user.id, :praise_count => 0, :position => params[:position], :challenge_id => params[:challenge_id]) + @discuss = Discuss.create!(:dis_id => params[:container_id], :dis_type => params[:container_type], + :content => params[:content].gsub(" \;", "").strip, :user_id => current_user.id, + :praise_count => 0, :position => params[:position], :challenge_id => params[:challenge_id], + :hidden => !current_user.admin?) # 管理员回复的能够显示 rescue Exception => e uid_logger_error("create discuss failed : #{e.message}") raise Educoder::TipException.new("评论异常") diff --git a/app/controllers/exercise_questions_controller.rb b/app/controllers/exercise_questions_controller.rb index 490791918..dd0247f70 100644 --- a/app/controllers/exercise_questions_controller.rb +++ b/app/controllers/exercise_questions_controller.rb @@ -424,14 +424,9 @@ class ExerciseQuestionsController < ApplicationController begin choice_d_id = params[:choice_no].to_i # 选项的当前位置 question_choices = @exercise_question.exercise_choices - delete_answer = question_choices.find_choice_custom("choice_position",choice_d_id).first - left_choice = question_choices.left_choice_choose("choice_position",choice_d_id) - if left_choice.present? - left_choice.each do |p| - p.choice_position -= 1 - p.save - end - end + delete_answer = question_choices.find_by(choice_position: choice_d_id) + left_choices = question_choices.where("choice_position > ? ",choice_d_id) + left_choices.update_all("choice_position = choice_position - 1") if left_choices if delete_answer.destroy normal_status(0, "答案删除成功!") else @@ -450,13 +445,8 @@ class ExerciseQuestionsController < ApplicationController begin question_d_id = @exercise_question.question_number.to_i #问题的当前位置 exercise_questions = @exercise.exercise_questions - left_question = exercise_questions.left_question_choose("question_number",question_d_id) - if left_question.present? - left_question.each do |q| - q.question_number -= 1 - q.save - end - end + left_questions = exercise_questions.where("question_number > ?", question_d_id) + left_questions.update_all("question_number = question_number - 1") if left_questions if @exercise_question.destroy normal_status(0, "问题删除成功!") else diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index f10bc81ff..01a2d540a 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -32,13 +32,13 @@ class ExercisesController < ApplicationController @exercises_all = @course.exercises member_show_exercises = @exercises_all.is_exercise_published #已发布的或已截止的试卷 @current_user_ = current_user - @exercises_count = @exercises_all.count # 全部页面,需返回 - @exercises_unpublish_counts = @exercises_all.exercise_by_status(1).count #未发布的试卷数 - @exercises_published_counts = @exercises_all.exercise_by_status([2,3]).count # 已发布的试卷数,包含已截止的 - @exercises_ended_counts = @exercises_all.exercise_by_status(3).count #已截止的试卷数 + @exercises_count = @exercises_all.size # 全部页面,需返回 + @exercises_unpublish_counts = @exercises_all.exercise_by_status(1).size #未发布的试卷数 + @exercises_published_counts = @exercises_all.exercise_by_status([2,3]).size # 已发布的试卷数,包含已截止的 + @exercises_ended_counts = @exercises_all.exercise_by_status(3).size #已截止的试卷数 # 课堂的学生人数 @course_all_members = @course.students #当前课堂的全部学生 - @course_all_members_count = @course_all_members.count #当前课堂的学生数 + @course_all_members_count = @course_all_members.size #当前课堂的学生数 @current_student = @course_all_members.course_find_by_ids("user_id",current_user.id) #当前用户是否为课堂的学生 # exercises的不同用户群体的显示 @@ -64,7 +64,7 @@ class ExercisesController < ApplicationController @is_teacher_or = 0 @exercises = member_show_exercises.present? ? member_show_exercises.unified_setting : [] end - if @exercises.count > 0 + if @exercises.size > 0 if params[:type].present? choose_type = params[:type].to_i member_group_id = @current_student.first.try(:course_group_id).to_i @@ -402,7 +402,7 @@ class ExercisesController < ApplicationController :position => c.position, :challenge_id => c.challenge_id, :shixun_id => q.shixun_id, - :question_score => q.question_score + :question_score => c.question_score } shixun_challenge_bank = exercise_bank_question.exercise_bank_shixun_challenges.new challenge_option shixun_challenge_bank.save @@ -729,7 +729,6 @@ class ExercisesController < ApplicationController if g_course.map(&:to_i).sort == user_course_groups.sort # 如果是设置为全部班级,则试卷不用分组,且试卷设定为统一设置,否则则分组设置 exercise.exercise_group_settings.destroy_all ex_unified = true - notify_receiver_ids = @course.students.pluck(:user_id) else ex_unified = false g_course.each do |i| @@ -749,12 +748,11 @@ class ExercisesController < ApplicationController end end - notify_receiver_ids = @course.students.where(course_group_id: params[:group_ids]).pluck(:user_id) + group_ids = params[:group_ids] end else exercise.exercise_group_settings.destroy_all ex_unified = true - notify_receiver_ids = @course.students.pluck(:user_id) end if exercise.end_time.blank? e_time = ex_end_time @@ -775,7 +773,7 @@ class ExercisesController < ApplicationController if exercise.course_acts.size == 0 exercise.course_acts << CourseActivity.new(:user_id => exercise.user_id,:course_id => exercise.course_id) end - ExercisePublishNotifyJob.perform_later(exercise.id, notify_receiver_ids) + ExercisePublishNotifyJob.perform_later(exercise.id, group_ids) end end end @@ -1334,7 +1332,7 @@ class ExercisesController < ApplicationController #导出空白试卷 def export_exercise - @exercise_questions = @exercise.exercise_questions.order("question_number ASC") + @exercise_questions = @exercise.exercise_questions.includes(:exercise_choices).order("question_number ASC") filename = "#{current_user.real_name}_#{@course.name}_#{@exercise.exercise_name}_#{Time.current.strftime('%Y%m%d%H%M%S')}.pdf" stylesheets = "#{Rails.root}/app/templates/exercise_export/exercise_export.css" render pdf: 'exercise_export/blank_exercise', filename: filename, stylesheets: stylesheets @@ -1512,39 +1510,42 @@ class ExercisesController < ApplicationController end def get_exercise_question_counts #获取试卷的问题数及总分数 - exercise_questions = @exercise.exercise_questions.all - @exercise_ques_count = exercise_questions.count # 全部的题目数 + exercise_questions = @exercise.exercise_questions + @exercise_ques_count = exercise_questions.size # 全部的题目数 @exercise_ques_scores = exercise_questions.pluck(:question_score).sum #单选题的数量及分数 exercise_single_ques = exercise_questions.find_by_custom("question_type",0) - @exercise_single_ques_count = exercise_single_ques.all.count + @exercise_single_ques_count = exercise_single_ques.size @exercise_single_ques_scores = exercise_single_ques.pluck(:question_score).sum #多选题的数量及分数 exercise_double_ques = exercise_questions.find_by_custom("question_type",1) - @exercise_double_ques_count = exercise_double_ques.all.count + @exercise_double_ques_count = exercise_double_ques.size @exercise_double_ques_scores = exercise_double_ques.pluck(:question_score).sum # 判断题数量及分数 exercise_ques_judge = exercise_questions.find_by_custom("question_type",2) - @exercise_ques_judge_count = exercise_ques_judge.all.count + @exercise_ques_judge_count = exercise_ques_judge.size @exercise_ques_judge_scores = exercise_ques_judge.pluck(:question_score).sum #填空题数量及分数 exercise_ques_null = exercise_questions.find_by_custom("question_type",3) - @exercise_ques_null_count = exercise_ques_null.all.count + @exercise_ques_null_count = exercise_ques_null.size @exercise_ques_null_scores = exercise_ques_null.pluck(:question_score).sum #简答题数量及分数 exercise_ques_main = exercise_questions.find_by_custom("question_type",4) - @exercise_ques_main_count = exercise_ques_main.all.count + @exercise_ques_main_count = exercise_ques_main.size @exercise_ques_main_scores = exercise_ques_main.pluck(:question_score).sum #实训题数量及分数 exercise_ques_shixun = exercise_questions.find_by_custom("question_type",5) - @exercise_ques_shixun_count = exercise_ques_shixun.all.count + @exercise_ques_shixun_count = exercise_ques_shixun.size @exercise_ques_shixun_scores = exercise_ques_shixun.pluck(:question_score).sum + + @exercise_questions = @exercise_questions&.includes(:exercise_choices,:exercise_shixun_challenges,:exercise_answers,:exercise_shixun_answers,:exercise_answer_comments,:exercise_standard_answers) + end #获取用户有权限的分班 diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index 5fe230d32..ac0b6baa8 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -270,7 +270,9 @@ class GamesController < ApplicationController if @game.status == 2 @game.update_attributes!(:answer_open => @answer.level) else - @game.update_attributes!(:answer_open => @answer.level, :answer_deduction => deduct_score) + # 扣除总分计算 + answer_deduction = challenge.challenge_answers.where("level <= #{@answer.level}").sum(:score) + @game.update_attributes!(:answer_open => @answer.level, :answer_deduction => answer_deduction) end rescue Exception => e @@ -342,11 +344,10 @@ class GamesController < ApplicationController @game.update_attribute(:test_sets_view, true) # 扣分记录 Grade.create(:user_id => current_user.id, :container_id => @game.id, :score => -@minus_grade, :container_type => "testSet") - @status = 0 - @message = "解锁成功!" + max_query_index = @game.query_index.to_i + testset_detail max_query_index, challenge else - @status = -1 - @message = "本操作需要扣除#{ @minus_grade }金币,您的金币不够了" + tip_exception(-1, "本操作需要扣除#{ @minus_grade }金币,您的金币不够了") end end @@ -811,7 +812,7 @@ class GamesController < ApplicationController # 评测测试机封装 def testset_detail max_query_index, challenge # 是否允许查看隐藏的测试集,以前的power - @allowed_hidden_testset = @identity < User::EDU_GAME_MANAGER + @allowed_hidden_testset = @identity < User::EDU_GAME_MANAGER || @game.test_sets_view #解锁的用户 if max_query_index > 0 uid_logger("max_query_index is #{max_query_index} game id is #{@game.id}, challenge_id is #{challenge.id}") diff --git a/app/controllers/graduation_tasks_controller.rb b/app/controllers/graduation_tasks_controller.rb index 2e72c57d3..93d3cba3d 100644 --- a/app/controllers/graduation_tasks_controller.rb +++ b/app/controllers/graduation_tasks_controller.rb @@ -59,7 +59,8 @@ class GraduationTasksController < ApplicationController # 任务发布的情况下: 是老师身份或者任务已截止的情况下公开任务了作品设置的学生也能查看其他人的作品 if @task.published? && (@user_course_identity < Course::STUDENT || (@user_course_identity == Course::STUDENT && @work.present? && @work.take.work_status > 0 && - @task.status > 1 && @task.open_work)) + ((!@task.allow_late && @task.status > 1) || (@task.allow_late && @task.late_time && @task.late_time < Time.now)) && + (@task.open_work || @task.open_score))) # 如有有分班则看分班内的学生,否则看所有学生的作品 user_ids = if @user_course_identity < Course::STUDENT @@ -117,6 +118,7 @@ class GraduationTasksController < ApplicationController @work_list = @work_list.joins(user: :user_extension).order("user_extensions.#{rorder} #{b_order}") end + @view_work = @task.open_work || @user_course_identity < Course::STUDENT @work_count = @work_list.count @work_excel = @work_list @@ -150,6 +152,7 @@ class GraduationTasksController < ApplicationController end else @work_list = @work + @view_work = false @work_count = @work_list.count @all_work_count = @work_list.count respond_to do |format| diff --git a/app/controllers/graduation_topics_controller.rb b/app/controllers/graduation_topics_controller.rb index ce4488ffd..c611069a8 100644 --- a/app/controllers/graduation_topics_controller.rb +++ b/app/controllers/graduation_topics_controller.rb @@ -24,8 +24,7 @@ class GraduationTopicsController < ApplicationController end # 当前用户是否已经选过题 - user_graduation_topics = @course.student_graduation_topics.where(user_id: current_user.id, status: [0, 1]) #6.12 -hs - @user_selected = user_graduation_topics.size > 0 + @user_selected = @course.student_graduation_topics.where(user_id: current_user.id, status: [0, 1]).count > 0 #6.12 -hs ## 分页参数 page = params[:page] || 1 limit = params[:limit] || 15 @@ -173,7 +172,7 @@ class GraduationTopicsController < ApplicationController member = @course.course_members.where(:user_id => @graduation_topic.tea_id).first tip_exception("分班名称不能为空") if params[:course_group_name].blank? course_group = CourseGroup.create(:name => params[:course_group_name], :course_id => @course.id) - teacher_group = TeacherCourseGroup.create(:course_id => @course.id, :member_id => member.try(:id), + teacher_group = TeacherCourseGroup.create(:course_id => @course.id, :course_member_id => member.try(:id), :user_id => @graduation_topic.tea_id, :course_group_id => course_group.try(:id)) end @@ -194,8 +193,8 @@ class GraduationTopicsController < ApplicationController def student_select_topic user_unaccept_topics = @course.student_graduation_topics.where(user_id: current_user.id, status: [0, 1]) if user_unaccept_topics.size == 0 - member_id = @course.course_members.find_by_user_id(current_user.id) - StudentGraduationTopic.create(course_id: @course.id, user_id: current_user.id, member_id: member_id, + member = @course.course_members.find_by_user_id(current_user.id) + StudentGraduationTopic.create(course_id: @course.id, user_id: current_user.id, course_member_id: member.try(:id), graduation_topic_id: @graduation_topic.id) @graduation_topic.update_attribute(:status, 1) normal_status("选题成功") diff --git a/app/controllers/graduation_works_controller.rb b/app/controllers/graduation_works_controller.rb index 9117112d3..7cf1a3393 100644 --- a/app/controllers/graduation_works_controller.rb +++ b/app/controllers/graduation_works_controller.rb @@ -13,6 +13,7 @@ class GraduationWorksController < ApplicationController before_action :published_task, only: [:new, :create, :edit, :update, :search_member_list, :relate_project, :cancel_relate_project, :revise_attachment] before_action :edit_duration, only: [:edit, :update] + before_action :open_work, only: [:show, :supply_attachments, :comment_list] def new if @task.task_type == 2 && @task.base_on_project @@ -432,11 +433,11 @@ class GraduationWorksController < ApplicationController # 交叉评阅分配老师 def assign_teacher tip_exception(-1, "user_id不能为空") if params[:user_id].nil? - @work_assign_teacher = @work.graduation_work_comment_assignations.first + @work_assign_teacher = @work.graduation_work_comment_assignations.find_by(user_id: params[:user_id]) - if @work_assign_teacher + if @work_assign_teacher.present? # graduation_group_id: 已经是答辩组的需要 将答辩组清空 - @work_assign_teacher.update_attributes(user_id: params[:user_id], graduation_group_id: 0) + @work_assign_teacher.update_attributes(graduation_group_id: 0) else @work.graduation_work_comment_assignations << GraduationWorkCommentAssignation.new(graduation_task_id: @task.id, user_id: params[:user_id], @@ -489,6 +490,11 @@ class GraduationWorksController < ApplicationController tip_exception("已过了修改时间") if @task.end_time && @task.end_time < Time.now end + # 作品是否公开 + def open_work + tip_exception(403,"没有操作权限") unless (@user_course_identity < Course::STUDENT || current_user == @work.user || @task.open_work) + end + def update_check work tip_exception("作品描述不能为空") if params[:description].blank? if @task.task_type == 2 diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 3aacd71fa..b89fd6b67 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -104,7 +104,7 @@ class HomeworkCommonsController < ApplicationController @shixun = @homework.shixuns.take if @homework.homework_type == "practice" student_works = @homework.all_works - @all_member_count = student_works.count + @all_member_count = student_works.size if @homework.publish_time.nil? || @homework.publish_time > Time.now @student_works = [] respond_to do |format| @@ -121,28 +121,31 @@ class HomeworkCommonsController < ApplicationController @work = @homework.user_work(current_user.id) # 学生已提交作品且补交(提交)已截止、作品公开、非匿评阶段 - if @work.work_status > 0 && @homework.work_public && + if @work&.work_status.to_i > 0 && (@homework.work_public || @homework.score_open) && ((!@homework.anonymous_comment && @homework.end_or_late) || @homework_detail_manual.comment_status > 4) - @student_works = student_works.where("user_id != #{@work.id}") + @student_works = student_works.where("user_id != #{@work.user_id}") # 匿评、申诉阶段只能看到分配给自己的匿评作品 - elsif @work.work_status > 0 && @homework.anonymous_comment && @homework_detail_manual.comment_status > 2 + elsif @work&.work_status.to_i > 0 && @homework.anonymous_comment && @homework_detail_manual.comment_status > 2 @is_evaluation = true @student_works = student_works.joins(:student_works_evaluation_distributions).where( "student_works_evaluation_distributions.user_id = #{@current_user.id}") else @student_works = [] end + @score_open = @homework.score_open && @work&.work_status.to_i > 0 elsif @user_course_identity < Course::STUDENT @student_works = @homework.teacher_works(@member) - @all_member_count = @student_works.count + @all_member_count = @student_works.size + @score_open = true elsif @user_course_identity > Course::STUDENT && @homework.work_public @student_works = student_works + @score_open = false else @student_works = [] end - unless @student_works.size == 0 + unless @student_works.blank? # 教师评阅搜索 0: 未评, 1 已评 unless params[:teacher_comment].blank? student_work_ids = StudentWorksScore.where(student_work_id: @student_works.map(&:id)).pluck(:student_work_id) @@ -187,12 +190,13 @@ class HomeworkCommonsController < ApplicationController # 分页参数 page = params[:page] || 1 limit = params[:limit] || 20 - @student_works = @student_works.page(page).per(limit).includes(:student_works_scores) + @student_works = @student_works.page(page).per(limit) if @homework.homework_type == "practice" - @student_works = @student_works.includes(user: :user_extension, myshixun: :games) + @student_works = @student_works.includes(:student_works_scores, user: :user_extension, myshixun: :games) else @student_works = @student_works.includes(:student_works_scores, :project, user: :user_extension) end + # @members = @course.students.where(user_id: @student_works.pluck(:user_id)).includes(:course_group) end respond_to do |format| format.json diff --git a/app/controllers/poll_questions_controller.rb b/app/controllers/poll_questions_controller.rb index 47cd236a9..84e21c4e8 100644 --- a/app/controllers/poll_questions_controller.rb +++ b/app/controllers/poll_questions_controller.rb @@ -156,14 +156,10 @@ class PollQuestionsController < ApplicationController begin answer_d_id = params[:answer_no].to_i # 答案的当前位置 poll_answers = @poll_question.poll_answers - delete_answer = poll_answers.find_answer_by_custom("answer_position",answer_d_id).first - left_answer = poll_answers.left_answer_choose("answer_position",answer_d_id) - if left_answer.present? - left_answer.each do |p| - p.answer_position -= 1 - p.save - end - end + delete_answer = poll_answers.find_by(answer_position: answer_d_id) + left_answers = poll_answers.where("answer_position > ?",answer_d_id) + left_answers.update_all("answer_position = answer_position - 1") if left_answers + if delete_answer.destroy normal_status(0, "答案删除成功!") else diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index 675e3283c..6fbba1c3d 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -263,7 +263,6 @@ class PollsController < ApplicationController if g_course.map(&:to_i).sort == user_course_groups.sort # 如果是设置为全部班级,则问卷不用分组,且问卷设定为统一设置,否则则分组设置 poll.poll_group_settings.destroy_all poll_unified = true - notify_student_ids = @course.students.pluck(:user_id) else poll_unified = false g_course.each do |i| @@ -282,13 +281,11 @@ class PollsController < ApplicationController new_poll_group.save end end - - notify_student_ids = @course.students.where(course_group_id: params[:group_ids]).pluck(:user_id) + group_ids = params[:group_ids] end else poll.poll_group_settings.destroy_all poll_unified = true - notify_student_ids = @course.students.pluck(:user_id) end if poll.end_time.blank? e_time = ex_end_time @@ -309,7 +306,7 @@ class PollsController < ApplicationController if poll.course_acts.size == 0 poll.course_acts << CourseActivity.new(:user_id => poll.user_id,:course_id => poll.course_id) end - PollPublishNotifyJob.perform_later(poll.id, notify_student_ids) + PollPublishNotifyJob.perform_later(poll.id, group_ids) end end normal_status(0, "问卷发布成功!") @@ -1184,7 +1181,7 @@ class PollsController < ApplicationController def check_poll_commit_result poll_status = @poll.get_poll_status(current_user.id) commit_poll_user = @poll.poll_users.find_by_group_ids(current_user.id).commit_by_status(1) #当前用户已提交问卷的 - unless @user_course_identity < Course::STUDENT || (@poll.show_result && poll_status == 3 && commit_poll_user.present?) + unless (@user_course_identity < Course::STUDENT) || ((@poll.show_result == 1) && (poll_status == 3) && commit_poll_user.present?) normal_status(-1,"没有权限!") #当前为老师/问卷公开统计,且问卷已截止,且用户有过回答的 end end diff --git a/app/controllers/question_banks_controller.rb b/app/controllers/question_banks_controller.rb index 740e3a993..22650f2d3 100644 --- a/app/controllers/question_banks_controller.rb +++ b/app/controllers/question_banks_controller.rb @@ -266,11 +266,12 @@ class QuestionBanksController < ApplicationController def quote_gtopic_bank topic, course ActiveRecord::Base.transaction do new_topic = GraduationTopic.new - new_topic.attributes = topic.attributes.dup.except("id", "course_id", "user_id", "graduation_topic_id", + new_topic.attributes = topic.attributes.dup.except("id", "course_id", "user_id", "graduation_topic_id", "quotes", "course_list_id", "gtopic_bank_id", "created_at", "updated_at") new_topic.course_id = course.id new_topic.gtopic_bank_id = topic.id new_topic.user_id = current_user.id + new_topic.tea_id = current_user.id new_topic.save topic.attachments.each.try(:each) do |attachment| diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 360732120..32a2c6ef9 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -2,8 +2,9 @@ class ShixunsController < ApplicationController before_action :require_login, except: [:download_file, :index, :menus] before_action :check_auth, except: [:download_file, :index] - before_action :find_shixun, except: [:index, :new, :create, :menus, :get_recommend_shixuns, :propaedeutics, - :departments, :apply_shixun_mirror, :get_mirror_script, :download_file] + before_action :find_shixun, :shixun_access_allowed, except: [:index, :new, :create, :menus, :get_recommend_shixuns, + :propaedeutics, :departments, :apply_shixun_mirror, + :get_mirror_script, :download_file] before_action :find_repo_name, only: [:repository, :commits, :file_content, :update_file, :shixun_exec, :copy] before_action :allowed, only: [:update, :close, :update_propaedeutics, :settings, :publish, @@ -488,17 +489,19 @@ class ShixunsController < ApplicationController tip_show_exception(-3, "#{@shixun.opening_time.strftime('%Y-%m-%d %H:%M:%S')}") end current_myshixun = @shixun.current_myshixun(current_user.id) + + min_challenges = @shixun.challenges.pluck(:id , :st) + if current_myshixun + games = current_myshixun.games # 如果TPM和TPI的管卡数不相等或者关卡顺序错了,说明实训被极大的改动,需要重置 - if current_myshixun.games.count != @shixun.challenges_count || - current_myshixun.games.reorder(:challenge_id).pluck(:challenge_id) != @shixun.challenges.reorder(:id).pluck(:id) - uid_logger_error("7777777777777777#{current_myshixun.games.count}, #{@shixun.challenges_count}") + if games.size != min_challenges.size || games.map(&:challenge_id) != min_challenges.map{|challenge| challenge.first} # 这里页面弹框要收到 当前用户myshixun的identifier. tip_show_exception("/myshixuns/#{current_myshixun.try(:identifier)}/reset_my_game") end # 如果存在实训,则直接进入实训 - @current_task = current_myshixun.current_task + @current_task = current_myshixun.current_task(games) else # 如果未创建关卡一定不能开启实训,否则TPI没法找到当前的关卡 if @shixun.challenges_count == 0 @@ -506,17 +509,17 @@ class ShixunsController < ApplicationController end # 判断实训是否全为选择题 - is_choice_type = @shixun.is_choice_type? + is_choice_type = (min_challenges.size == min_challenges.select{|challenge| challenge.last == 1}.count) if !is_choice_type commit = GitService.commits(repo_path: @repo_path).try(:first) - Rails.logger.info("First comit########{commit}") + uid_logger("First comit########{commit}") tip_exception("开启实战前请先在版本库中提交代码") if commit.blank? commit_id = commit["id"] end ActiveRecord::Base.transaction do begin - #cloud_bridge = edu_setting('cloud_bridge') + cloud_bridge = edu_setting('cloud_bridge') myshixun_identifier = generate_identifier Myshixun, 10 myshixun = @shixun.myshixuns.create!(user_id: current_user.id, identifier: myshixun_identifier, modify_time: @shixun.modify_time, reset_time: @shixun.reset_time, @@ -528,29 +531,34 @@ class ShixunsController < ApplicationController # fork仓库 project_fork(myshixun, @repo_path, current_user.login) - #rep_url = Base64.urlsafe_encode64(repo_ip_url @repo_path ) - #uid_logger("start openGameInstance") - #uri = "#{cloud_bridge}/bridge/game/openGameInstance" - #logger.info("end openGameInstance") - #params = {tpiID: "#{myshixun.id}", tpmGitURL:rep_url, tpiRepoName: myshixun.repo_name.split("/").last} - #uid_logger("openGameInstance params is #{params}") - # res = interface_post uri, params, 83, "实训云平台繁忙(繁忙等级:83)" + rep_url = Base64.urlsafe_encode64(repo_ip_url @repo_path ) + uid_logger("start openGameInstance") + uri = "#{cloud_bridge}/bridge/game/openGameInstance" + logger.info("end openGameInstance") + params = {tpiID: "#{myshixun.id}", tpmGitURL:rep_url, tpiRepoName: myshixun.repo_name.split("/").last} + uid_logger("openGameInstance params is #{params}") + interface_post uri, params, 83, "实训云平台繁忙(繁忙等级:83)" end # 其它创建关卡等操作 challenges = @shixun.challenges # 之所以增加user_id是为了方便统计查询性能 - challenges.each_with_index do |challenge, index| - status = (index == 0 ? 0 : 3) - game_identifier = generate_identifier(Game, 12) - Game.create!(:challenge_id => challenge.id, :myshixun_id => myshixun.id, :status => status, :user_id => myshixun.user_id, - :open_time => Time.now, :identifier => game_identifier, :modify_time => challenge.modify_time) + game_attrs = %i[challenge_id myshixun_id status user_id open_time identifier modify_time created_at updated_at] + Game.bulk_insert(*game_attrs) do |worker| + base_attr = { myshixun_id: myshixun.id, user_id: myshixun.user_id } + challenges.each_with_index do |challenge, index| + status = (index == 0 ? 0 : 3) + game_identifier = generate_identifier(Game, 12) + worker.add(base_attr.merge(challenge_id: challenge.id, status: status, open_time: Time.now, + identifier: game_identifier, modify_time: challenge.modify_time)) + end end # REDO:开启实训时更新关联作品的状态 # TODO:这个可以异步。或者放到课程里面取,不要在开启实训这边做 - HomeworksService.new.update_myshixun_work_status myshixun + # HomeworksService.new.update_myshixun_work_status myshixun + UpdateMyshixunWorkStatusJob.perform_later(myshixun.id) - @current_task = myshixun.current_task + @current_task = myshixun.current_task(myshixun.games) uid_logger("## shixun exec: myshixun id is #{myshixun.id}") rescue Exception => e uid_logger_error(e.message) @@ -559,10 +567,8 @@ class ShixunsController < ApplicationController end end end - - - end + # gameID 及实训ID # status: 0 , 1 申请过, 2,实训关卡路径未填, 3 实训标签未填, 4 实训未创建关卡 def publish @@ -617,11 +623,22 @@ class ShixunsController < ApplicationController end def add_collaborators - raise("搜索内容不能为空") unless params[:search] - member_ids = "(" + @shixun.shixun_members.map(&:user_id).join(',') + ")" - condition = "%#{params[:search].strip}%".gsub(" ","") - @users = User.where("id not in #{member_ids} and status = 1 and LOWER(concat(lastname, firstname, login, mail, nickname)) LIKE '#{condition}'") - end + member_ids = "(" + @shixun.shixun_members.map(&:user_id).join(',') + ")" + user_name = "%#{params[:user_name].to_s.strip}%" + school_name = "%#{params[:school_name].to_s.strip}%" + if user_name.present? || school_name.present? + @users = User.joins(user_extension: :school).where("users.id not in #{member_ids} AND users.status = 1 AND + LOWER(users.lastname) LIKE '#{user_name}' AND LOWER(schools.name) LIKE + '#{school_name}'") + else + @users = User.none + end + page = params[:page] || 1 + limit = params[:limit] || 20 + @users_count = @users.count + @users = @users.page(page).per(limit) + + end def shixun_members_added raise("user_ids 不能为空!") if params[:user_ids].blank? @@ -662,14 +679,14 @@ class ShixunsController < ApplicationController limit = params[:limit] || 20 if params[:search] search = "%#{params[:search].to_s.strip.downcase}%" - course_ids = Course.find_by_sql("SELECT c.id FROM courses c, members m, member_roles mr - WHERE m.course_id = c.id AND m.id=mr.member_id AND mr.role_id in (3,7,9) + course_ids = Course.find_by_sql("SELECT c.id FROM courses c, course_members m + WHERE m.course_id = c.id AND m.role in (1,2,3) AND m.user_id=#{current_user.id} AND c.is_delete = 0 AND c.is_end = 0 AND c.name like '#{search}' ").map(&:id) else - course_ids = Course.find_by_sql("SELECT c.id, c.name FROM courses c, members m, member_roles mr - WHERE m.course_id = c.id AND m.id=mr.member_id AND mr.role_id in (3,7,9) + course_ids = Course.find_by_sql("SELECT c.id, c.name FROM courses c, course_members m + WHERE m.course_id = c.id AND m.role in (1,2,3) AND m.user_id=#{current_user.id} AND c.is_delete = 0 AND c.is_end = 0").map(&:id) end @@ -681,7 +698,7 @@ class ShixunsController < ApplicationController # 将实训发送到课程 def send_to_course @course = Course.find(params[:course_id]) - homework = HomeworksService.new.create_homework shixun, @course, nil, current_user + homework = HomeworksService.new.create_homework @shixun, @course, nil, current_user end # 二维码扫描下载 @@ -715,10 +732,6 @@ private normal_status(404, "...") return end - - if !current_user.shixun_permission(@shixun) - tip_exception(403, "..") - end end def find_repo_name diff --git a/app/controllers/student_works_controller.rb b/app/controllers/student_works_controller.rb index 7e23443d2..ab026cf05 100644 --- a/app/controllers/student_works_controller.rb +++ b/app/controllers/student_works_controller.rb @@ -25,7 +25,7 @@ class StudentWorksController < ApplicationController before_action :require_score_id, only: [:destroy_score, :add_score_reply, :appeal_anonymous_score, :deal_appeal_score, :cancel_appeal] - before_action :is_evaluation, only: [:show, :supply_attachments] + before_action :is_evaluation, :open_work, only: [:show, :supply_attachments] def new uid_logger("#######new current_user : 1111") @@ -434,7 +434,7 @@ class StudentWorksController < ApplicationController # 用户最大评测次数 if @games - @user_evaluate_count = @games.sum(:evaluate_count) + @user_evaluate_count = @games.pluck(:evaluate_count).sum @games = @games.includes(:challenge, :game_codes, :outputs) else @user_evaluate_count = 0 @@ -450,7 +450,7 @@ class StudentWorksController < ApplicationController @games = @work.myshixun.games.includes(:challenge, :game_codes, :outputs) if @work.myshixun # 用户最大评测次数 - @user_evaluate_count = @games.sum(:evaluate_count) if @games + @user_evaluate_count = @games.pluck(:evaluate_count).sum if @games # 图形效率图的数据 @echart_data = student_efficiency(@homework, @work) @myself_eff = @echart_data[:efficiency_list].find { |item| item.last == @user.id } @@ -704,6 +704,11 @@ class StudentWorksController < ApplicationController [3, 4].include?(@homework.homework_detail_manual.comment_status) end + # 作品是否公开 + def open_work + tip_exception(403,"没有操作权限") unless (@user_course_identity < Course::STUDENT || current_user == @work.user || @homework.work_public || @is_evaluation) + end + def allow_add_score # 老师始终有评阅权限,匿评阶段内,学生对分配给该学生的作品有评阅权限 tip_exception(403, "没有权限") unless allow_score(@homework, @user_course_identity, current_user.id, @work) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 4b954584b..c73fec500 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -164,8 +164,8 @@ class SubjectsController < ApplicationController end def choose_course - course_ids = Course.find_by_sql("SELECT c.id FROM courses c, members m, member_roles mr - WHERE m.course_id = c.id AND m.id=mr.member_id AND mr.role_id in (3,7,9) + course_ids = Course.find_by_sql("SELECT c.id FROM courses c, course_members m + WHERE m.course_id = c.id AND m.role in (1,2,3) AND m.user_id=#{current_user.id} AND c.is_delete = 0 AND c.is_end = 0").map(&:id) @courses = Course.where(id: course_ids) @none_shixun_ids = ShixunSchool.where("school_id != #{current_user.user_extension.try(:school_id)}").pluck(:shixun_id) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 93b8bfc50..fa51de6b7 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -232,7 +232,7 @@ module CoursesHelper course.course_groups.includes(:course_members) end group_info = [] - if course_groups.count > 0 + if !course_groups.blank? course_groups.each do |group| group_info << {course_group_id: group.id, group_group_name: group.name, count: group.course_members_count} end diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index 9ea7578f2..a2a80c311 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -13,7 +13,8 @@ module ExercisesHelper ques_score = q.exercise_answers.search_answer_users("user_id",user_id).score_reviewed.pluck(:score).sum end - if ques_score == q.question_score #满分作答为正确 + if ques_score >= q.question_score #满分作答为正确 + ques_score = q.question_score stand_answer = 1 elsif ques_score > 0.0 #部分作答 stand_answer = 2 @@ -35,7 +36,8 @@ module ExercisesHelper exercise_sub_status.each do |s| sub_answer = s.exercise_answers.search_answer_users("user_id",user_id) #主观题只有一个回答 if sub_answer.present? && sub_answer.first.score >= 0.0 - if s.question_score == sub_answer.first.score + + if s.question_score <= sub_answer.first.score stand_status = 1 else stand_status = 2 @@ -44,7 +46,7 @@ module ExercisesHelper sub_answer_score = sub_answer.first.score else stand_status = 0 - sub_answer_score = 0.0 + sub_answer_score = nil end sub_score = { @@ -52,7 +54,7 @@ module ExercisesHelper "q_type":s.question_type, "q_position":s.question_number, "stand_status":stand_status, - "user_score":sub_answer_score.round(1).to_s + "user_score":sub_answer_score.present? ? sub_answer_score.round(1).to_s : nil } @ex_sub_array.push(sub_score) end @@ -419,8 +421,10 @@ module ExercisesHelper if game.present? exercise_cha_score = 0.0 answer_status = 0 - if game.status == 2 && game.final_score >= 0 - exercise_cha_score = exercise_cha.question_score #每一关卡的得分 + # if game.status == 2 && game.final_score >= 0 + if game.final_score > 0 + exercise_cha_score = game.real_score(exercise_cha.question_score) + # exercise_cha_score = exercise_cha.question_score #每一关卡的得分 answer_status = 1 end ex_shixun_answer_content = answers_content&.where(exercise_shixun_challenge_id: exercise_cha.id) @@ -437,7 +441,7 @@ module ExercisesHelper :exercise_question_id => q.id, :exercise_shixun_challenge_id => exercise_cha.id, :user_id => user.id, - :score => exercise_cha_score, + :score => exercise_cha_score.round(1), :answer_text => code, :status => answer_status } @@ -504,15 +508,14 @@ module ExercisesHelper current_user_group_name = course_group.first.name if course_group.present? end teacher_review = ex_user.subjective_score < 0.0 ? false : true - if ex_user_exercise_status != 3 || commit_status != 1 #试卷未截止或用户未提交 - # if (user_status != 0 && ex_user_exercise_status != 3)|| commit_status == 0 #不为教师,且试卷未截止;当前用户未提交 不显示分数 - ex_object_score = nil - ex_subject_score = nil - score = nil - else + if (user_status == 0 && commit_status == 1) || (user_status == 1 && ex_user_exercise_status == 3 && commit_status == 1) #老师都可以看,学生,需在试卷已提交,且已截止的情况下看 ex_object_score = ex_user.objective_score < 0.0 ? 0.0 : ex_user.objective_score.round(1).to_s ex_subject_score = ex_user.subjective_score < 0.0 ? nil : ex_user.subjective_score.round(1).to_s score = ex_user.score.present? ? ex_user.score.round(1).to_s : 0.0.to_s + else + ex_object_score = nil + ex_subject_score = nil + score = nil end { @@ -624,16 +627,21 @@ module ExercisesHelper #学生的分数状态及回答的内容 def user_question_answers(q,ex_answerer_id,student_status,is_teacher_or,ex_status,ques_type,ex_type) answered_content = [] - user_score = 0.0 + user_score = nil shixun_type = 0 question_comment = [] - if q.question_type == 5 + if ques_type == 5 exercise_answers = q.exercise_shixun_answers.search_shixun_answers("user_id",ex_answerer_id) else exercise_answers = q.exercise_answers.search_exercise_answer("user_id",ex_answerer_id) #试卷用户的回答 end if student_status == 2 #当前为老师,或为学生且已提交 - user_score = exercise_answers.score_reviewed.pluck(:score).sum + user_score_pre = exercise_answers.score_reviewed + user_score = user_score_pre.present? ? user_score_pre.pluck(:score).sum : nil + end + + if user_score.present? && (user_score > q.question_score) + user_score = q.question_score end if ques_type <= 2 answered_content = exercise_answers.pluck(:exercise_choice_id) @@ -661,7 +669,7 @@ module ExercisesHelper question_comment = q.exercise_answer_comments.search_answer_comments("exercise_answer_id",q_answer_id) end { - "user_score": user_score.round(1), + "user_score": (user_score.present? ? user_score.round(1).to_s : nil), "answered_content":answered_content, "shixun_type":shixun_type, "question_comment":question_comment diff --git a/app/helpers/homework_commons_helper.rb b/app/helpers/homework_commons_helper.rb index 261fc85e9..c77ae5937 100644 --- a/app/helpers/homework_commons_helper.rb +++ b/app/helpers/homework_commons_helper.rb @@ -65,7 +65,7 @@ module HomeworkCommonsHelper # 作业统一设置、游客身份、超级管理员、分班权限不限的老师身份 if homework_common.unified_setting || identity > Course::STUDENT || identity == Course::ADMIN || - (identity < Course::STUDENT && teacher_course_groups.size == 0) + (identity < Course::STUDENT && teacher_course_groups.blank?) case ho_detail_manual.comment_status when 0 status << "未发布" diff --git a/app/helpers/polls_helper.rb b/app/helpers/polls_helper.rb index 56bbb9b77..b5ba79dcc 100644 --- a/app/helpers/polls_helper.rb +++ b/app/helpers/polls_helper.rb @@ -3,8 +3,8 @@ module PollsHelper #获取试卷的已答/未答人数 def get_poll_answers(poll_users) @commit_poll_users = poll_users.commit_by_status(1) #当前老师的全部学生中已提交的 - @poll_answers = @commit_poll_users.present? ? @commit_poll_users.count : 0 #表示已经提交了的用户 - course_all_members_count = poll_users.present? ? poll_users.count : 0 + @poll_answers = @commit_poll_users.present? ? @commit_poll_users.size : 0 #表示已经提交了的用户 + course_all_members_count = poll_users.present? ? poll_users.size : 0 @poll_unanswers = (course_all_members_count - @poll_answers) end diff --git a/app/helpers/student_works_helper.rb b/app/helpers/student_works_helper.rb index 682bfbf81..a7103b4bf 100644 --- a/app/helpers/student_works_helper.rb +++ b/app/helpers/student_works_helper.rb @@ -54,13 +54,13 @@ module StudentWorksHelper objects = myshixuns.map do |myshixun| # 评测次数 - evaluate_count = myshixun.games.sum(:evaluate_count) + evaluate_count = myshixun.games.pluck(:evaluate_count).sum # 获取最大评测次数 max_evaluate_count = (evaluate_count > max_evaluate_count ? evaluate_count : max_evaluate_count) # 通关耗时 - pass_consume_time = (myshixun.games.where(status: 2).pluck(:cost_time).sum / 60.0) + pass_consume_time = (myshixun.total_cost_time / 60.0) # 总耗时 - all_time = (myshixun.games.sum(:cost_time) / 60.0) + all_time = (myshixun.games.pluck(:cost_time).sum / 60.0) # 通关得分 user_total_score = myshixun.total_score.to_i # 耗时,保留2位小数, @@ -145,7 +145,7 @@ module StudentWorksHelper else user_name = message_user.real_name user_login = message_user.login - image_url = url_to_avatar(score.user) + image_url = url_to_avatar(message_user) end {user_name: user_name, user_login: user_login, user_image_url: image_url} end diff --git a/app/jobs/exercise_publish_notify_job.rb b/app/jobs/exercise_publish_notify_job.rb index c66fa5660..563f6ceb0 100644 --- a/app/jobs/exercise_publish_notify_job.rb +++ b/app/jobs/exercise_publish_notify_job.rb @@ -2,11 +2,20 @@ class ExercisePublishNotifyJob < ApplicationJob queue_as :notify - def perform(exercise_id, receiver_ids) + def perform(exercise_id, group_ids) exercise = Exercise.find_by(id: exercise_id) return if exercise.blank? user = exercise.user + if group_ids.present? + students = course.students.where(course_group_id: group_ids) + subquery = course.teacher_course_groups.where(course_group_id: group_ids).select(:course_member_id) + teachers = course.teachers.where(id: subquery) + else + students = course.students + teachers = course.teachers + end + attrs = %i[ user_id trigger_user_id container_id container_type parent_container_id parent_container_type belong_container_id belong_container_type viewed tiding_type created_at updated_at @@ -19,14 +28,14 @@ class ExercisePublishNotifyJob < ApplicationJob viewed: 0, tiding_type: 'Exercise' } Tiding.bulk_insert(*attrs) do |worker| - teacher_ids = exercise.course.teachers.pluck(:user_id) + teacher_ids = teachers.pluck(:user_id) unless exercise.tidings.exists?(parent_container_type: 'ExercisePublish', user_id: teacher_ids) - exercise.course.teachers.find_each do |teacher| - worker.add same_attrs.merge(user_id: teacher.user_id) + teacher_ids.find_each do |user_id| + worker.add same_attrs.merge(user_id: user_id) end end - receiver_ids.each do |user_id| + students.pluck(:user_id).each do |user_id| worker.add same_attrs.merge(user_id: user_id) end end diff --git a/app/jobs/graduation_task_cross_comment_job.rb b/app/jobs/graduation_task_cross_comment_job.rb new file mode 100644 index 000000000..64973a3e9 --- /dev/null +++ b/app/jobs/graduation_task_cross_comment_job.rb @@ -0,0 +1,39 @@ +# 毕设任务的交叉评阅分配 +class GraduationTaskCrossCommentJob < ApplicationJob + queue_as :evaluation_comment + + def perform(graduation_task_id) + task = GraduationTask.find_by(id: graduation_task_id) + return if task.blank? + + course = task.course + task.graduation_task_group_assignations.each do |assignation| + graduation_group = assignation.graduation_group + assign_group = assignation.assign_group + if graduation_group.present? && assign_group.present? + course_group_ids = course.teacher_course_groups.where(course_member_id: graduation_group.course_members.pluck(:id)).pluck(:course_group_id) + graduation_works = task.graduation_works.where(user_id: course.course_members.where(:course_group_id => course_group_ids).map(&:user_id), + work_status: [1, 2]) + if assign_group.course_members.count <= task.comment_num + graduation_works.each do |work| + assign_group.course_members.each do |member| + work.graduation_work_comment_assignations << GraduationWorkCommentAssignation.new( + graduation_group_id: assign_group.id, user_id: member.user_id, graduation_task_id: task.id) + end + end + else + member_user_ids = assign_group.course_members.pluck(:user_id) + count = 0 + graduation_works.each do |work| + for i in 1 .. task.comment_num + assign_user_id = member_user_ids[count % member_user_ids.size] + work.graduation_work_comment_assignations << GraduationWorkCommentAssignation.new( + graduation_group_id: assign_group.id, user_id: assign_user_id, graduation_task_id: task.id) + count += 1 + end + end + end + end + end + end +end diff --git a/app/jobs/graduation_task_publish_notify_job.rb b/app/jobs/graduation_task_publish_notify_job.rb index 3489aa711..92346ab27 100644 --- a/app/jobs/graduation_task_publish_notify_job.rb +++ b/app/jobs/graduation_task_publish_notify_job.rb @@ -18,8 +18,8 @@ class GraduationTaskPublishNotifyJob < ApplicationJob viewed: 0, tiding_type: 'GraduationTask' } Tiding.bulk_insert(*attrs) do |worker| - task.course.students.find_each do |student| - worker.add same_attrs.merge(user_id: student.user_id) + task.course.course_members.pluck(:user_id).uniq.find_each do |user_id| + worker.add same_attrs.merge(user_id: user_id) end end end diff --git a/app/jobs/homework_absence_penalty_calculation_job.rb b/app/jobs/homework_absence_penalty_calculation_job.rb new file mode 100644 index 000000000..87f78f311 --- /dev/null +++ b/app/jobs/homework_absence_penalty_calculation_job.rb @@ -0,0 +1,33 @@ +class HomeworkAbsencePenaltyCalculationJob < ApplicationJob + queue_as :score + + def perform(homework_common_id) + homework_common = HomeworkCommon.find_by(id: homework_common_id) + return if homework_common.blank? + + #计算缺评扣分 参与匿评 + work_ids = homework_common.student_works.has_committed.pluck(:id) + homework_detail_manual = homework_common.homework_detail_manual + + homework_common.student_works.where("work_status != 0").each do |student_work| + absence_penalty_count = student_work.user.student_works_evaluation_distributions.where(student_work_id: work_ids).count - + student_work.user.student_works_scores.where(student_work_id: work_ids, reviewer_role: 3).group_by(:student_work_id).count + + student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0 + student_work.save + end + + # 未参与匿评 + if homework_detail_manual.no_anon_penalty == 0 + all_dis_eva = StudentWorksEvaluationDistribution.where(student_work_id: work_ids) + has_sw_count = all_dis_eva.select("distinct user_id").count + anon_count = all_dis_eva.count / has_sw_count + homework_common.student_works.where("work_status != 0").each do |student_work| + if student_work.user.student_works_evaluation_distributions.where(student_work_id: work_ids).count == 0 + student_work.absence_penalty = homework_detail_manual.absence_penalty * anon_count + student_work.save + end + end + end + end +end diff --git a/app/jobs/homework_anonymous_appeal_start_notify_job.rb b/app/jobs/homework_anonymous_appeal_start_notify_job.rb new file mode 100644 index 000000000..1c3098690 --- /dev/null +++ b/app/jobs/homework_anonymous_appeal_start_notify_job.rb @@ -0,0 +1,28 @@ +# 匿评申诉开启时给分配了匿评的学生发消息 +class HomeworkAnonymousAppealStartNotifyJob < ApplicationJob + queue_as :notify + + def perform(homework_common_id) + homework = HomeworkCommon.find_by(id: homework_common_id) + return if homework.blank? + eva_distribution = StudentWorksEvaluationDistribution.where(student_work_id: homework.student_works.pluck(:id)) + + attrs = %i[ + user_id trigger_user_id container_id container_type parent_container_id parent_container_type + belong_container_id belong_container_type viewed tiding_type created_at updated_at + ] + + same_attrs = { + trigger_user_id: homework.user_id, container_id: homework.id, container_type: 'HomeworkCommon', + parent_container_id: homework.id, parent_container_type: 'AnonymousAppeal', + belong_container_id: homework.course_id, belong_container_type: 'Course', + viewed: 0, tiding_type: 'HomeworkCommon' + } + Tiding.bulk_insert(*attrs) do |worker| + + eva_distribution.pluck(:user_id).uniq.each do |user_id| + worker.add same_attrs.merge(user_id: user_id) + end + end + end +end diff --git a/app/jobs/homework_common_push_notify_job.rb b/app/jobs/homework_common_push_notify_job.rb index 961face58..47956a14c 100644 --- a/app/jobs/homework_common_push_notify_job.rb +++ b/app/jobs/homework_common_push_notify_job.rb @@ -24,7 +24,7 @@ class HomeworkCommonPushNotifyJob < ApplicationJob same_attrs = { trigger_user_id: homework.user_id, container_id: homework.id, container_type: 'HomeworkCommon', parent_container_id: homework.id, parent_container_type: 'HomeworkPublish', - belong_container_id: task.course_id, belong_container_type: 'Course', + belong_container_id: homework.course_id, belong_container_type: 'Course', viewed: 0, tiding_type: 'HomeworkCommon' } Tiding.bulk_insert(*attrs) do |worker| diff --git a/app/jobs/homework_evaluation_comment_assgin_job.rb b/app/jobs/homework_evaluation_comment_assgin_job.rb new file mode 100644 index 000000000..5921386f2 --- /dev/null +++ b/app/jobs/homework_evaluation_comment_assgin_job.rb @@ -0,0 +1,48 @@ +class HomeworkEvaluationCommentAssginJob < ApplicationJob + queue_as :evaluation_comment + + def get_assigned_homeworks(student_works, n, index) + student_works += student_works + student_works[index + 1..index + n] + end + + def perform(homework_common_id) + homework_common = HomeworkCommon.find_by(id: homework_common_id) + return if homework_common.blank? + homework_detail_manual = homework_common.homework_detail_manual + + if homework_common.homework_type == "group" + student_works = homework_common.student_works.where("work_status != 0").group(:group_id) + student_work_projects = homework_common.student_works.where("work_status != 0").shuffle + student_work_projects.each do |pro_work| + n = homework_detail_manual.evaluation_num + n = (n < student_works.length && n != -1) ? n : student_works.length - 1 + work_index = -1 + student_works.each_with_index do |stu_work, stu_index| + if stu_work.group_id.to_i == pro_work.group_id.to_i + work_index = stu_index + end + end + assigned_homeworks = get_assigned_homeworks(student_works, n, work_index) + assigned_homeworks.each do |h| + student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id) + student_works_evaluation_distributions.save + end + end + + else + student_works = homework_common.student_works.has_committed + student_works = student_works.shuffle + student_works.each_with_index do |work, index| + user = work.user + n = homework_detail_manual.evaluation_num + n = (n < student_works.size && n != -1) ? n : student_works.size - 1 + assigned_homeworks = get_assigned_homeworks(student_works, n, index) + assigned_homeworks.each do |h| + student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id) + student_works_evaluation_distributions.save + end + end + end + end +end diff --git a/app/jobs/homework_evaluation_start_notify_job.rb b/app/jobs/homework_evaluation_start_notify_job.rb new file mode 100644 index 000000000..709c37b32 --- /dev/null +++ b/app/jobs/homework_evaluation_start_notify_job.rb @@ -0,0 +1,30 @@ +class HomeworkEvaluationStartNotifyJob < ApplicationJob + queue_as :notify + + def perform(homework_common_id, content) + homework = HomeworkCommon.find_by(id: homework_common_id) + return if homework.blank? + course = homework.course + members = content.blank? ? course.course_members : course.teachers + tiding_type = content.blank? ? "HomeworkCommon" : "System" + + attrs = %i[ + user_id trigger_user_id container_id container_type parent_container_id parent_container_type + belong_container_id belong_container_type viewed tiding_type extra created_at updated_at + ] + + same_attrs = { + trigger_user_id: homework.user_id, container_id: homework.id, container_type: 'HomeworkCommon', + parent_container_id: homework.id, parent_container_type: 'AnonymousComment', + belong_container_id: homework.course_id, belong_container_type: 'Course', + viewed: 0, tiding_type: tiding_type, extra: content + } + Tiding.bulk_insert(*attrs) do |worker| + member_ids = members.pluck(:user_id).uniq + + member_ids.each do |user_id| + worker.add same_attrs.merge(user_id: user_id) + end + end + end +end diff --git a/app/jobs/homework_publish_update_work_status_job.rb b/app/jobs/homework_publish_update_work_status_job.rb index 0060ab270..fe03a3ac5 100644 --- a/app/jobs/homework_publish_update_work_status_job.rb +++ b/app/jobs/homework_publish_update_work_status_job.rb @@ -1,6 +1,6 @@ class HomeworkPublishUpdateWorkStatusJob < ApplicationJob # 作业发布时更新学生(发布前已开启过实训)的作业状态和成绩 - queue_as :default + queue_as :score def perform(group_ids, homework_id) # Do something later diff --git a/app/jobs/poll_publish_notify_job.rb b/app/jobs/poll_publish_notify_job.rb index bc31957e0..89fb45ea5 100644 --- a/app/jobs/poll_publish_notify_job.rb +++ b/app/jobs/poll_publish_notify_job.rb @@ -2,10 +2,20 @@ class PollPublishNotifyJob < ApplicationJob queue_as :notify - def perform(poll_id, receiver_ids) + def perform(poll_id, group_ids) poll = Poll.find_by(id: poll_id) return if poll.blank? user = poll.user + course = poll.course + + if group_ids.present? + students = course.students.where(course_group_id: group_ids) + subquery = course.teacher_course_groups.where(course_group_id: group_ids).select(:course_member_id) + teachers = course.teachers.where(id: subquery) + else + students = course.students + teachers = course.teachers + end attrs = %i[ user_id trigger_user_id container_id container_type parent_container_id parent_container_type @@ -19,14 +29,14 @@ class PollPublishNotifyJob < ApplicationJob viewed: 0, tiding_type: 'Poll' } Tiding.bulk_insert(*attrs) do |worker| - teacher_ids = poll.course.teachers.pluck(:user_id) + teacher_ids = teachers.pluck(:user_id) unless poll.tidings.exists?(parent_container_type: 'PollPublish', user_id: teacher_ids) - poll.course.teachers.find_each do |teacher| - worker.add same_attrs.merge(user_id: teacher.user_id) + teacher_ids.find_each do |user_id| + worker.add same_attrs.merge(user_id: user_id) end end - receiver_ids.each do |user_id| + students.pluck(:user_id).each do |user_id| worker.add same_attrs.merge(user_id: user_id) end end diff --git a/app/jobs/update_myshixun_work_status_job.rb b/app/jobs/update_myshixun_work_status_job.rb new file mode 100644 index 000000000..27a53408f --- /dev/null +++ b/app/jobs/update_myshixun_work_status_job.rb @@ -0,0 +1,10 @@ +class UpdateMyshixunWorkStatusJob < ApplicationJob + queue_as :default + + def perform(myshixun_id) + myshixun = Myshixun.find_by(id: myshixun_id) + return if myshixun.blank? + + HomeworksService.new.update_myshixun_work_status myshixun + end +end diff --git a/app/models/challenge.rb b/app/models/challenge.rb index a5d9874ce..07a49196d 100644 --- a/app/models/challenge.rb +++ b/app/models/challenge.rb @@ -38,7 +38,7 @@ class Challenge < ApplicationRecord ## 选择题总分 def choose_score - self.challenge_chooses.sum(:score) + self.challenge_chooses.pluck(:score).sum end # 关卡总分 @@ -51,9 +51,8 @@ class Challenge < ApplicationRecord end # 开启挑战 - def open_game(user_id) - game = self.games.select([:status, :identifier]).where(user_id: user_id).first - shixun = self.shixun + def open_game user_id, shixun + game = self.games.first if game.present? shixun.task_pass || game.status != 3 ? "/tasks/#{game.identifier}" : "" else @@ -61,18 +60,31 @@ class Challenge < ApplicationRecord end end + # # 开启挑战 + # def open_game(user_id, shixun) + # + # + # game = self.games.select([:status, :identifier]).where(user_id: user_id).first + # game = self.games.select{|game| game.user_id == user_id} + # if game.present? + # shixun.task_pass || game.status != 3 ? "/tasks/#{game.identifier}" : "" + # else + # "/api/shixuns/#{shixun.identifier}/shixun_exec" + # end + # end + ## 用户关卡状态 0: 不能开启实训; 1:直接开启; 2表示已完成 def user_tpi_status user_id # todo: 以前没加索引导致相同关卡,同一用户有多个games - game = self.games.where(user_id: user_id).last - status = - if game.blank? - self.position == 1 ? 1 : 0 - elsif game.status == 2 - 2 - else - 1 - end + game = games.last + + if game.blank? + self.position == 1 ? 1 : 0 + elsif game.status == 2 + 2 + else + 1 + end end ## 选择题答案 diff --git a/app/models/discuss.rb b/app/models/discuss.rb index 602813e66..93f0d62cd 100644 --- a/app/models/discuss.rb +++ b/app/models/discuss.rb @@ -33,10 +33,16 @@ class Discuss < ApplicationRecord "/tasks/#{game&.identifier}" end - def contents(shixun, user) - return content unless hidden? - - shixun.has_manager?(user) ? content : '违规评论已被屏蔽!' + # def contents(shixun, user) + # return content unless hidden? + # + # shixun.has_manager?(user) ? content : '' + # end + + def child_discuss(user) + user.admin? ? + Discuss.where(parent_id: self.id).includes(:user).reorder(created_at: :asc) : + Discuss.where(parent_id: self.id, :hidden => false).includes(:user).reorder(created_at: :asc) end private diff --git a/app/models/exercise.rb b/app/models/exercise.rb index 0c8b97ca7..60409e51d 100644 --- a/app/models/exercise.rb +++ b/app/models/exercise.rb @@ -3,11 +3,11 @@ class Exercise < ApplicationRecord belongs_to :exercise_bank, optional: true belongs_to :user - has_many :exercise_users,:dependent => :destroy - has_many :exercise_questions,:dependent => :destroy - has_many :exercise_group_settings,:dependent => :destroy + has_many :exercise_users, :dependent => :delete_all + has_many :exercise_questions, :dependent => :delete_all + has_many :exercise_group_settings, :dependent => :delete_all has_many :tidings, as: :container - has_many :course_acts, class_name: 'CourseActivity', as: :course_act, dependent: :destroy + has_many :course_acts, class_name: 'CourseActivity', as: :course_act, :dependent => :delete_all scope :is_exercise_published, -> { where("exercise_status > ? ",1)} scope :unified_setting, -> { where("unified_setting = ?",true) } diff --git a/app/models/exercise_answer.rb b/app/models/exercise_answer.rb index 465fa036b..11558f937 100644 --- a/app/models/exercise_answer.rb +++ b/app/models/exercise_answer.rb @@ -3,7 +3,7 @@ class ExerciseAnswer < ApplicationRecord belongs_to :user belongs_to :exercise_question belongs_to :exercise_choice, optional: true - has_many :exercise_answer_comments, :dependent => :destroy + has_many :exercise_answer_comments, :dependent => :delete_all scope :search_exercise_answer, lambda { |name,key| where("#{name} = ?",key)} scope :search_answer_users, lambda {|name,ids| where("#{name}":ids)} diff --git a/app/models/exercise_choice.rb b/app/models/exercise_choice.rb index 525251ce6..72dc30c9d 100644 --- a/app/models/exercise_choice.rb +++ b/app/models/exercise_choice.rb @@ -1,9 +1,10 @@ class ExerciseChoice < ApplicationRecord belongs_to :exercise_question - has_many :exercise_answers, :dependent => :destroy - has_many :exercise_standard_answers, :dependent => :destroy + has_many :exercise_answers, :dependent => :delete_all + has_many :exercise_standard_answers, :dependent => :delete_all scope :find_choice_custom, lambda {|k,v| where("#{k} = ?",v)} #根据传入的参数查找问题 scope :left_choice_choose, lambda {|k,v| where("#{k} > ?",v)} #根据传入的参数查找问题 + end \ No newline at end of file diff --git a/app/models/exercise_question.rb b/app/models/exercise_question.rb index 5f456e21f..2c9b281c3 100644 --- a/app/models/exercise_question.rb +++ b/app/models/exercise_question.rb @@ -4,19 +4,18 @@ class ExerciseQuestion < ApplicationRecord belongs_to :exercise belongs_to :shixun, optional: true - has_many :exercise_choices, :dependent => :destroy - has_many :exercise_answers, :dependent => :destroy - has_many :exercise_shixun_challenges,:dependent => :destroy - has_many :exercise_shixun_answers, :dependent => :destroy - has_many :exercise_answer_comments, :dependent => :destroy - has_many :exercise_standard_answers, :dependent => :destroy + has_many :exercise_choices, :dependent => :delete_all + has_many :exercise_answers + has_many :exercise_shixun_challenges, :dependent => :delete_all + has_many :exercise_shixun_answers + has_many :exercise_answer_comments + has_many :exercise_standard_answers scope :insert_question_ex, lambda {|k| where("question_number > ?",k)} scope :find_by_custom, lambda {|k,v| where("#{k} = ?",v)} #根据传入的参数查找问题 scope :left_question_choose, lambda {|k,v| where("#{k} > ?",v)} #根据传入的参数查找问题 scope :find_objective_questions, -> {where("question_type != ?",4)} #查找全部客观题 - # scope :next_exercise, lambda {|k| where("question_number > ?",k).first} - # scope :last_exercise, lambda {|k| where("question_number < ?",k).last} + def question_type_name case self.question_type diff --git a/app/models/exercise_shixun_answer.rb b/app/models/exercise_shixun_answer.rb index 8548e497d..a9550c024 100644 --- a/app/models/exercise_shixun_answer.rb +++ b/app/models/exercise_shixun_answer.rb @@ -2,7 +2,7 @@ class ExerciseShixunAnswer < ApplicationRecord belongs_to :exercise_question belongs_to :user belongs_to :exercise_shixun_challenge - has_many :exercise_answer_comments, :dependent => :destroy + has_many :exercise_answer_comments, :dependent => :delete_all # status 0: 未通过, 1:通过 # attr_accessible :answer_text, :score, :status scope :search_shixun_answers, lambda {|name,ids| where("#{name}":ids)} diff --git a/app/models/graduation_work.rb b/app/models/graduation_work.rb index 49cab19ee..e9be0a43e 100644 --- a/app/models/graduation_work.rb +++ b/app/models/graduation_work.rb @@ -63,7 +63,7 @@ class GraduationWork < ApplicationRecord #用户是否有查看分数的权限 def check_score_power? current_user, course_identity - self.work_score.present? || course_identity < Course::STUDENT || self.user_id = current_user.id + self.work_score.present? && (course_identity < Course::STUDENT || self.user_id = current_user.id || graduation_task.open_score) end # 作品是否能够分配指导老师 diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index 9cc2c9a69..6512c3f1d 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -70,7 +70,7 @@ class HomeworkCommon < ApplicationRecord if self.course_second_category.present? {category_id: self.course_second_category.try(:id), category_name: self.course_second_category.try(:name)} else - {category_id: course.shixun_course_modules.first.try(:id), category_name: course.shixun_course_modules.first.try(:module_name)} + {category_id: course.shixun_course_modules.take.try(:id), category_name: course.shixun_course_modules.take.try(:module_name)} end end end @@ -78,8 +78,7 @@ class HomeworkCommon < ApplicationRecord # 根据是否统一发布获取作业的作品列表 def all_works student_works = self.unified_setting ? self.student_works : - self.student_works.joins("join course_members on student_works.user_id=course_members.user_id"). - where(course_members: {course_group_id: self.published_settings.pluck(:course_group_id)}) + self.student_works.joins("join course_members on student_works.user_id=course_members.user_id").where(course_members: {course_group_id: self.published_settings.pluck(:course_group_id)}) end # 分班权限的老师可见的作品列表 @@ -90,7 +89,7 @@ class HomeworkCommon < ApplicationRecord # 有分班权限的统计管理的分班且已发布的学生情况 if member.present? && teacher_course_groups.size > 0 group_ids = teacher_course_groups.pluck(:course_group_id) - all_student_works = all_student_works.joins("join course_members course_members on student_works.user_id=course_members.user_id"). + all_student_works = all_student_works.joins("join course_members on student_works.user_id=course_members.user_id"). where(course_members: {course_group_id: group_ids}) end all_student_works @@ -170,12 +169,8 @@ class HomeworkCommon < ApplicationRecord #删除时更新题库中的引用数 def update_homework_bank_quotes - old_banks = self.homework_bank - unless old_banks.blank? - old_banks.each do |bank| - bank.update_attributes(quotes: (bank.quotes - 1) > 0 ? (bank.quotes - 1) : 0, homework_common_id: nil) - end - end + old_bank = self.homework_bank + old_bank.update_attributes(quotes: (old_bank.quotes - 1) > 0 ? (old_bank.quotes - 1) : 0, homework_common_id: nil) if old_bank.present? end # 查重是否有新结果 diff --git a/app/models/myshixun.rb b/app/models/myshixun.rb index b5bbdc249..d8f294a39 100644 --- a/app/models/myshixun.rb +++ b/app/models/myshixun.rb @@ -53,14 +53,12 @@ class Myshixun < ApplicationRecord end # 当前任务:一个实训中只可能一个未完成任务(status 0或1只会存在一条记录) - # status:0 可以测评的,正在测评的 + # status:0 可以测评的; 1 正在测评的; 2评测通过的; 3未开启的 # 如果都完成,则当前任务为最后一个任务 - def current_task - games = self.games + def current_task games current_game = games.select{|game| game.status == 1 || game.status == 0}.first if current_game.blank? - current_game = Game.find_by_sql("SELECT g.* FROM games g, challenges c where g.myshixun_id=#{self.id} - and g.challenge_id = c.id and g.status = 2 order by c.position desc").first + current_game = games.last end current_game end @@ -74,12 +72,12 @@ class Myshixun < ApplicationRecord # 个人实训得分 def total_score - self.games.where("status = 2 and final_score > 0").sum(:final_score).to_i + self.games.select{|game| game.status == 2 && game.final_score > 0}.pluck(:final_score).sum.to_i end # 个人通关数 def passed_count - self.games.where(status: 2).count + self.games.select{|game| game.status == 2}.size end # 通关时间 @@ -89,12 +87,12 @@ class Myshixun < ApplicationRecord # 耗时 def total_spend_time - game_spend_time self.games.where(status: 2).sum(:cost_time).to_i + game_spend_time total_cost_time end # 通关总耗时 def total_cost_time - self.games.where(status: 2).sum(:cost_time).to_i + self.games.select{|game| game.status == 2}.map(&:cost_time).sum.to_i end end diff --git a/app/models/poll.rb b/app/models/poll.rb index b498eda4e..f72239ba7 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -4,13 +4,13 @@ class Poll < ApplicationRecord belongs_to :exercise_bank, optional: true # belongs_to :exercise_bank - has_many :poll_questions,dependent: :destroy - has_many :poll_users, :dependent => :destroy + has_many :poll_questions,dependent: :delete_all + has_many :poll_users, :dependent => :delete_all has_many :users, :through => :poll_users #该文件被哪些用户提交答案过 - has_many :poll_group_settings, :dependent => :destroy - has_many :course_acts, class_name: 'CourseActivity', as: :course_act, dependent: :destroy + has_many :poll_group_settings, :dependent => :delete_all + has_many :course_acts, class_name: 'CourseActivity', as: :course_act, dependent: :delete_all - has_many :tidings, as: :container, dependent: :destroy + has_many :tidings, as: :container, dependent: :delete_all scope :publish_or_not, -> { where("polls_status > ? ",1)} scope :only_public, -> {where("is_public = ?",true)} @@ -137,16 +137,17 @@ class Poll < ApplicationRecord #判断当前用户的答题状态 def check_user_votes_status(user) poll_answer_user = poll_users.find_by(user_id: user.id) - user_poll_status = get_poll_status(user.id) + # user_poll_status = get_poll_status(user.id) user_status = 2 if poll_answer_user.present? && (poll_answer_user.start_at.present? || poll_answer_user.end_at.present?) #学生有过答题的,或者立即截止,但学生未做试卷的 user_status = poll_answer_user.commit_status end - - if poll_answer_user.present? && poll_answer_user.start_at.blank? && user_poll_status == 3 - user_status = 4 - end + # + # if poll_answer_user.present? && poll_answer_user.start_at.blank? && user_poll_status == 3 + # # user_status = 4 + # user_status = 2 #问卷用户存在,且未开始答题,且问卷已截止时,返回未提交标示 + # end user_status end diff --git a/app/models/poll_answer.rb b/app/models/poll_answer.rb index 423198bbf..8e2421328 100644 --- a/app/models/poll_answer.rb +++ b/app/models/poll_answer.rb @@ -3,7 +3,7 @@ class PollAnswer < ApplicationRecord # include Redmine::SafeAttributes belongs_to :poll_question - has_many :poll_votes, :dependent => :destroy + has_many :poll_votes, :dependent => :delete_all scope :find_answer_by_custom, lambda {|k,v| where("#{k}":v)} #根据传入的参数查找问题 scope :left_answer_choose, lambda {|k,v| where("#{k} > ?",v)} #根据传入的参数查找问题 diff --git a/app/models/poll_question.rb b/app/models/poll_question.rb index 1fc8e0c16..a0854aa48 100644 --- a/app/models/poll_question.rb +++ b/app/models/poll_question.rb @@ -1,9 +1,9 @@ class PollQuestion < ApplicationRecord belongs_to :poll - has_many :poll_answers, :dependent => :destroy + has_many :poll_answers, :dependent => :delete_all attr_accessor :question_answers, :question_other_anser - has_many :poll_votes, :dependent => :destroy + has_many :poll_votes scope :ques_count, lambda {|k| where("question_type = ?",k)} scope :ques_necessary, -> {where("is_necessary = ?",1)} diff --git a/app/models/student_work.rb b/app/models/student_work.rb index 0e674dd4c..d5b746ebd 100644 --- a/app/models/student_work.rb +++ b/app/models/student_work.rb @@ -39,24 +39,34 @@ class StudentWork < ApplicationRecord # 助教评分次数 def ta_comment_count - self.student_works_scores.where(reviewer_role: 2).group_by(&:user_id).count + self.student_works_scores.select{|score| score.reviewer_role == 2}.group_by(&:user_id).count end # 匿评次数 def student_comment_num - homework_common.homework_detail_manual.comment_status > 2 ? self.student_works_scores.where(reviewer_role: 3).group_by(&:user_id).count : 0 + homework_common.homework_detail_manual.comment_status > 2 ? self.student_works_scores.select{|score| score.reviewer_role == 3}.group_by(&:user_id).count : 0 end # 匿评申诉总条数 def appeal_all_count - homework_common.homework_detail_manual.comment_status >= 3 ? self.student_works_scores.where("reviewer_role = 3 and appeal_status != 0"). - group_by(&:user_id).count : 0 + homework_common.homework_detail_manual.comment_status >= 3 ? self.student_works_scores. + select{|score| score.reviewer_role == 3 && score.appeal_status != 0}.group_by(&:user_id).count : 0 end # 匿评申诉待处理条数 def appeal_deal_count - homework_common.homework_detail_manual.comment_status >= 3 ? self.student_works_scores.where("reviewer_role = 3 and appeal_status = 1"). - group_by(&:user_id).count : 0 + homework_common.homework_detail_manual.comment_status >= 3 ? self.student_works_scores. + select{|score| score.reviewer_role == 3 && score.appeal_status == 1}.group_by(&:user_id).count : 0 + end + + # 当前用户该作品的匿评申诉总条数 + def my_appeal_all_count user_id + student_works_scores.select{|score| score.reviewer_role == 3 && score.appeal_status != 0 && score.user_id == user_id}.size + end + + # 当前用户该作品的匿评申诉总条数 + def my_appeal_deal_count user_id + student_works_scores.select{|score| score.reviewer_role == 3 && score.appeal_status == 1 && score.user_id == user_id}.size end # 分组名 diff --git a/app/services/exercise_user_pdf_service.rb b/app/services/exercise_user_pdf_service.rb index d74e66d31..22804092e 100644 --- a/app/services/exercise_user_pdf_service.rb +++ b/app/services/exercise_user_pdf_service.rb @@ -48,42 +48,41 @@ class ExerciseUserPdfService def load_data @exercise_questions = exercise.exercise_questions - @exercise_ques_count = @exercise_questions.count # 全部的题目数 + @exercise_ques_count = @exercise_questions.size # 全部的题目数 @exercise_ques_scores = @exercise_questions.pluck(:question_score).sum #单选题的数量及分数 exercise_single_ques = @exercise_questions.find_by_custom("question_type",0) - @exercise_single_ques_count = exercise_single_ques.all.count + @exercise_single_ques_count = exercise_single_ques.size @exercise_single_ques_scores = exercise_single_ques.pluck(:question_score).sum #多选题的数量及分数 exercise_double_ques = @exercise_questions.find_by_custom("question_type",1) - @exercise_double_ques_count = exercise_double_ques.all.count + @exercise_double_ques_count = exercise_double_ques.size @exercise_double_ques_scores = exercise_double_ques.pluck(:question_score).sum # 判断题数量及分数 exercise_ques_judge = @exercise_questions.find_by_custom("question_type",2) - @exercise_ques_judge_count = exercise_ques_judge.all.count + @exercise_ques_judge_count = exercise_ques_judge.size @exercise_ques_judge_scores = exercise_ques_judge.pluck(:question_score).sum #填空题数量及分数 exercise_ques_null = @exercise_questions.find_by_custom("question_type",3) - @exercise_ques_null_count = exercise_ques_null.all.count + @exercise_ques_null_count = exercise_ques_null.size @exercise_ques_null_scores = exercise_ques_null.pluck(:question_score).sum #简答题数量及分数 exercise_ques_main = @exercise_questions.find_by_custom("question_type",4) - @exercise_ques_main_count = exercise_ques_main.all.count + @exercise_ques_main_count = exercise_ques_main.size @exercise_ques_main_scores = exercise_ques_main.pluck(:question_score).sum #实训题数量及分数 exercise_ques_shixun = @exercise_questions.find_by_custom("question_type",5) - @exercise_ques_shixun_count = exercise_ques_shixun.all.count + @exercise_ques_shixun_count = exercise_ques_shixun.size @exercise_ques_shixun_scores = exercise_ques_shixun.pluck(:question_score).sum - challenge_ids = @exercise_questions.joins(:exercise_shixun_challenges).pluck("exercise_shixun_challenges.challenge_id") - + @exercise_questions = @exercise_questions&.includes(:exercise_choices,:exercise_shixun_challenges,:exercise_answers,:exercise_shixun_answers,:exercise_answer_comments,:exercise_standard_answers) get_each_student_exercise(exercise.id,@exercise_questions,@ex_user_user.id) - @games = @exercise_user.user.games.ch_games(challenge_ids) + end end \ No newline at end of file diff --git a/app/services/git_service.rb b/app/services/git_service.rb index 3298185bf..076f62920 100644 --- a/app/services/git_service.rb +++ b/app/services/git_service.rb @@ -33,7 +33,12 @@ class GitService res = https.request(req) body = res.body logger.info("--uri_exec: .....res is #{body}") + content = JSON.parse(body) + if content["code"] != 0 + raise("版本库异常") + logger.error("repository error: #{content['msg']}") + end #raise content["msg"] if content["code"] != 0 content["data"] diff --git a/app/tasks/exercise_publish_task.rb b/app/tasks/exercise_publish_task.rb index 3df5f84ae..220512664 100644 --- a/app/tasks/exercise_publish_task.rb +++ b/app/tasks/exercise_publish_task.rb @@ -8,39 +8,24 @@ class ExercisePublishTask exercises = Exercise.includes(:exercise_users).where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now) exercises&.each do |exercise| exercise.update_column('exercise_status', 2) - course = exercise.course - tid_str = "" - course.teachers.find_each do |member| - tid_str += "," if tid_str != "" - tid_str += "(#{member.user_id}, #{exercise.user_id}, #{exercise.id}, 'Exercise', #{exercise.id}, 'ExercisePublish', #{course.id}, 'Course', 0, 'Exercise', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')" - end + if exercise.unified_setting - course.students.find_each do |student| + ExercisePublishNotifyJob.perform_later(exercise.id, nil) + else + course = exercise.course + teachers = course.teachers.where.not(id: course.teacher_course_groups.select(:course_member_id)) + tid_str = "" + teachers.find_each do |member| tid_str += "," if tid_str != "" - tid_str += "(#{student.user_id}, #{exercise.user_id}, #{exercise.id}, 'Exercise', #{exercise.id}, 'ExercisePublish', #{course.id}, 'Course', 0, 'Exercise', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')" + tid_str += "(#{member.user_id}, #{exercise.user_id}, #{exercise.id}, 'Exercise', #{exercise.id}, 'ExercisePublish', #{course.id}, 'Course', 0, 'Exercise', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')" end - end - if tid_str != "" - tid_sql = "insert into tidings (user_id, trigger_user_id, container_id, container_type, parent_container_id, parent_container_type, belong_container_id, belong_container_type, viewed, tiding_type, created_at, updated_at) values" + tid_str - ActiveRecord::Base.connection.execute tid_sql - end - - if exercise.exercise_users.size == 0 - str = "" - course.students.find_each do |student| - str += "," if str != "" - str += "(#{student.user_id}, #{exercise.id}, 0, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')" - end - - if str != "" - sql = "insert into exercise_users (user_id, exercise_id, commit_status, created_at, updated_at) values" + str - ActiveRecord::Base.connection.execute sql + if tid_str != "" + tid_sql = "insert into tidings (user_id, trigger_user_id, container_id, container_type, parent_container_id, parent_container_type, belong_container_id, belong_container_type, viewed, tiding_type, created_at, updated_at) values" + tid_str + ActiveRecord::Base.connection.execute tid_sql end end - if exercise.course_acts.size == 0 - exercise.course_acts << CourseActivity.new(:user_id => exercise.user_id,:course_id => exercise.course_id) - end + exercise.course_acts << CourseActivity.new(user_id: exercise.user_id, course_id: exercise.course_id) if !exercise.course_acts.exists? end # 分组设置发布时间的测验 @@ -48,18 +33,8 @@ class ExercisePublishTask exercise_group_settings&.each do |exercise_group| exercise = exercise_group.exercise if exercise.present? - course = exercise.course exercise.update_attributes(:exercise_status => 2) if exercise.exercise_status == 1 - tid_str = "" - members = course.students.where(:course_group_id => exercise_group.course_group_id) - members.find_each do |member| - tid_str += "," if tid_str != "" - tid_str += "(#{member.user_id},#{exercise.user_id}, #{exercise.id}, 'Exercise', #{exercise.id}, 'ExercisePublish', #{course.id}, 'Course', 0, 'Exercise', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')" - end - if tid_str != "" - tid_sql = "insert into tidings (user_id, trigger_user_id, container_id, container_type, parent_container_id, parent_container_type, belong_container_id, belong_container_type, viewed, tiding_type, created_at, updated_at) values" + tid_str - ActiveRecord::Base.connection.execute tid_sql - end + ExercisePublishNotifyJob.perform_later(exercise.id, [exercise_group.course_group_id]) end end Rails.logger.info("log--------------------------------exercise_publish end") diff --git a/app/templates/exercise_export/exercise_export.css b/app/templates/exercise_export/exercise_export.css index 59be4f1bd..9190e9251 100644 --- a/app/templates/exercise_export/exercise_export.css +++ b/app/templates/exercise_export/exercise_export.css @@ -156,7 +156,7 @@ p{ position: absolute; display: inline-block; bottom: 6px; - /*left: 1px;*/ + left: 1px; } .line-line { @@ -231,7 +231,7 @@ p{ position: absolute; display: inline-block; bottom: 9px; - left: 1px; + left: 2px; } .circle-right:after{ color:#fff; diff --git a/app/templates/exercise_export/exercise_user.html.erb b/app/templates/exercise_export/exercise_user.html.erb index 193a25301..c81f45d68 100644 --- a/app/templates/exercise_export/exercise_user.html.erb +++ b/app/templates/exercise_export/exercise_user.html.erb @@ -112,6 +112,7 @@
实训详情
- <% @games.each_with_index do |game, index| %> + <% games&.each_with_index do |game, index| %>第<%= index+1 %>关<%= game.challenge.subject %> diff --git a/app/views/challenges/index.json.jbuilder b/app/views/challenges/index.json.jbuilder index 0b90b5ca5..6b92be411 100644 --- a/app/views/challenges/index.json.jbuilder +++ b/app/views/challenges/index.json.jbuilder @@ -17,7 +17,7 @@ if @challenges.present? json.passed_count challenge.user_passed_count json.playing_count challenge.playing_count json.name_url shixun_challenge_path(challenge, shixun_identifier: @shixun.identifier) - json.open_game challenge.open_game(@user.id) + json.open_game challenge.open_game(@user.id, @shixun) if @editable json.edit_url edit_shixun_challenge_path(challenge, shixun_identifier: @shixun.identifier) json.delete_url shixun_challenge_path(challenge, shixun_identifier: @shixun.identifier) diff --git a/app/views/discusses/_discuss.json.jbuilder b/app/views/discusses/_discuss.json.jbuilder index 1fcf150bc..e7e6e425f 100644 --- a/app/views/discusses/_discuss.json.jbuilder +++ b/app/views/discusses/_discuss.json.jbuilder @@ -2,7 +2,7 @@ json.author do json.partial! 'users/user', user: discuss.user end json.id discuss.id -json.content discuss.contents(container, current_user) +json.content discuss.content json.time time_from_now(discuss.created_at) json.position discuss.position json.shixun_id discuss.dis_id diff --git a/app/views/discusses/index.json.jbuilder b/app/views/discusses/index.json.jbuilder index 3d0ee9fc9..1b7a95eb3 100644 --- a/app/views/discusses/index.json.jbuilder +++ b/app/views/discusses/index.json.jbuilder @@ -2,8 +2,7 @@ json.disscuss_count @disscuss_count json.all @current_user.admin? json.comments @discusses do |discuss| json.partial! 'discusses/discuss', locals: { discuss: discuss, container: @container, current_user: @current_user } - child_discuss = Discuss.children(discuss.id) - json.children child_discuss do |c_d| + json.children discuss.child_discuss(current_user) do |c_d| json.partial! 'discusses/discuss', locals: { discuss: c_d, container: @container, current_user: @current_user } end end diff --git a/app/views/exercise_questions/_exercise_questions.json.jbuilder b/app/views/exercise_questions/_exercise_questions.json.jbuilder index 7a05c2e11..9445862ba 100644 --- a/app/views/exercise_questions/_exercise_questions.json.jbuilder +++ b/app/views/exercise_questions/_exercise_questions.json.jbuilder @@ -6,10 +6,11 @@ json.question_type question.question_type json.question_score question.question_score.round(1).to_s if question.question_type <= 2 #当为选择题或判断题时,只显示选项的位置 standard_answers_array = question.get_standard_answer_ids - exercise_choices = choices.order("choice_position ASC") ex_choice_random_boolean = (exercise_type.present? && exercise_type == 3 && (question.exercise.choice_random)) ? true : false #问题的选项随机打乱 if ex_choice_random_boolean - exercise_choices = exercise_choices.order("RAND()") + exercise_choices = choices.order("RAND()") + else + exercise_choices = choices.order("choice_position ASC") end json.question_choices do json.array! exercise_choices.each_with_index.to_a do |a,index| diff --git a/app/views/exercises/_user_exercise_info.json.jbuilder b/app/views/exercises/_user_exercise_info.json.jbuilder index 5b5d0c725..1ff929897 100644 --- a/app/views/exercises/_user_exercise_info.json.jbuilder +++ b/app/views/exercises/_user_exercise_info.json.jbuilder @@ -47,14 +47,13 @@ end json.exercise_questions do json.array! exercise_questions do |q| - user_ques_answers = user_question_answers(q,ex_answerer.id,student_status,is_teacher_or,exercise_status,q.question_type,ex_type) user_ques_comments = user_ques_answers[:question_comment] if all_question_status.size > 0 this_ques_status = all_question_status.detect {|f| f[:q_id] == q.id} json.answer_status this_ques_status[:stand_status] end - json.user_score user_ques_answers[:user_score].to_s + json.user_score user_ques_answers[:user_score] json.partial! "exercise_questions/exercise_questions", question: q, ex_answerer: ex_answerer, diff --git a/app/views/exercises/start_answer.json.jbuilder b/app/views/exercises/start_answer.json.jbuilder index 4cc461d56..42d611712 100644 --- a/app/views/exercises/start_answer.json.jbuilder +++ b/app/views/exercises/start_answer.json.jbuilder @@ -40,8 +40,8 @@ json.exercise_questions do question_info = get_exercise_question_info(question,@exercise,@exercise_user_current,@ex_answerer.id) # json.q_position q[:ques_number] #问题的序号,当问题为随机时,重新更新后的问题序号 if @t_user_exercise_status == 3 - this_answer_status = "0.0" - user_score = "0.0" + this_answer_status = 0 + user_score = nil if all_question_status.size > 0 this_ques_status = all_question_status.detect {|f| f[:q_id] == question.id} this_answer_status = this_ques_status[:stand_status] diff --git a/app/views/games/check_test_sets.json.jbuilder b/app/views/games/check_test_sets.json.jbuilder index 017a75aea..ba1ed64a6 100644 --- a/app/views/games/check_test_sets.json.jbuilder +++ b/app/views/games/check_test_sets.json.jbuilder @@ -1,2 +1,10 @@ -json.status @status -json.message @message \ No newline at end of file +json.test_sets @qurey_test_sets do |test_set| + json.is_public test_set.is_public + json.result test_set.try(:result) + if test_set.is_public || @allowed_hidden_testset + json.input test_set.input + json.output test_set.output + json.actual_output evaluate_actual_output(test_set) + end + json.compile_success test_set.try(:compile_success) +end \ No newline at end of file diff --git a/app/views/graduation_tasks/tasks_list.json.jbuilder b/app/views/graduation_tasks/tasks_list.json.jbuilder index 62c95901f..7588b6b6e 100644 --- a/app/views/graduation_tasks/tasks_list.json.jbuilder +++ b/app/views/graduation_tasks/tasks_list.json.jbuilder @@ -59,6 +59,7 @@ if @task.published? || @user_course_identity < Course::STUDENT json.late_penalty work.late_penalty if @task.allow_late json.final_score work_final_score work, @current_user, @user_course_identity json.assign work.assign_power?(@user_course_identity) + json.view_work @view_work || @current_user.id == work.user_id end end end \ No newline at end of file diff --git a/app/views/homework_commons/_homework_public_navigation.json.jbuilder b/app/views/homework_commons/_homework_public_navigation.json.jbuilder index 2c803bee8..2c548074c 100644 --- a/app/views/homework_commons/_homework_public_navigation.json.jbuilder +++ b/app/views/homework_commons/_homework_public_navigation.json.jbuilder @@ -10,5 +10,5 @@ json.homework_name homework.name json.homework_id homework.id json.homework_type homework.homework_type if homework.homework_type == "practice" - json.shixun_identifier homework.shixuns.first.try(:identifier) + json.shixun_identifier homework.shixuns.take.try(:identifier) end diff --git a/app/views/homework_commons/index.json.jbuilder b/app/views/homework_commons/index.json.jbuilder index d718550c1..5b9717c2f 100644 --- a/app/views/homework_commons/index.json.jbuilder +++ b/app/views/homework_commons/index.json.jbuilder @@ -2,10 +2,6 @@ json.course_identity @user_course_identity json.homework_type @homework_type json.course_public @course.is_public == 1 json.is_end @course.is_end -json.all_count @all_count -json.published_count @published_count -json.unpublished_count @all_count - @published_count -json.task_count @task_count json.main_category_id @main_category.try(:id) json.main_category_name @main_category.try(:module_name) json.category_id @category.try(:id) @@ -46,3 +42,8 @@ json.homeworks @homework_commons.each do |homework| end end +json.all_count @all_count +json.published_count @published_count +json.unpublished_count @all_count - @published_count +json.task_count @task_count + diff --git a/app/views/homework_commons/works_list.json.jbuilder b/app/views/homework_commons/works_list.json.jbuilder index 0c1ed0c5b..60441909b 100644 --- a/app/views/homework_commons/works_list.json.jbuilder +++ b/app/views/homework_commons/works_list.json.jbuilder @@ -33,19 +33,19 @@ elsif @user_course_identity == Course::STUDENT json.late_penalty @work.late_penalty if @homework.allow_late json.cost_time @work.myshixun.try(:total_cost_time) - json.work_score work_score_format(@work.work_score, true, @homework.score_open) - json.final_score work_score_format(@work.final_score, true, @homework.score_open) - json.efficiency work_score_format(@work.efficiency, true, @homework.score_open) - json.eff_score work_score_format(@work.eff_score, true, @homework.score_open) + json.work_score work_score_format(@work.work_score, true, @score_open) + json.final_score work_score_format(@work.final_score, true, @score_open) + json.efficiency work_score_format(@work.efficiency, true, @score_open) + json.eff_score work_score_format(@work.eff_score, true, @score_open) json.complete_count @work.myshixun.try(:passed_count) else json.(@work, :id, :work_status, :update_time, :ultimate_score) - json.work_score work_score_format(@work.work_score, true, @homework.score_open) - json.final_score work_score_format(@work.final_score, true, @homework.score_open) - json.teacher_score work_score_format(@work.teacher_score, true, @homework.score_open) - json.student_score work_score_format(@work.student_score, true, @homework.score_open) - json.teaching_asistant_score work_score_format(@work.teaching_asistant_score, true, @homework.score_open) + json.work_score work_score_format(@work.work_score, true, @score_open) + json.final_score work_score_format(@work.final_score, true, @score_open) + json.teacher_score work_score_format(@work.teacher_score, true, @score_open) + json.student_score work_score_format(@work.student_score, true, @score_open) + json.teaching_asistant_score work_score_format(@work.teaching_asistant_score, true, @score_open) json.ta_comment_count @work.ta_comment_count @@ -84,10 +84,10 @@ if @homework.homework_type == "practice" json.(work, :id, :work_status, :update_time, :ultimate_score) json.late_penalty work.late_penalty if @homework.allow_late - json.work_score work_score_format(work.work_score, @current_user == work.user, @homework.score_open) - json.final_score work_score_format(work.final_score, @current_user == work.user, @homework.score_open) - json.efficiency work_score_format(work.efficiency, @current_user == work.user, @homework.score_open) - json.eff_score work_score_format(work.eff_score, @current_user == work.user, @homework.score_open) + json.work_score work_score_format(work.work_score, @current_user == work.user, @score_open) + json.final_score work_score_format(work.final_score, @current_user == work.user, @score_open) + json.efficiency work_score_format(work.efficiency, @current_user == work.user, @score_open) + json.eff_score work_score_format(work.eff_score, @current_user == work.user, @score_open) json.cost_time work.myshixun.try(:total_cost_time) json.complete_count work.myshixun.try(:passed_count) @@ -101,22 +101,27 @@ elsif @homework.homework_type == "group" || @homework.homework_type == "normal" json.anonymous_appeal @homework.anonymous_appeal json.student_works @student_works.each do |work| - if @is_evaluation json.(work, :id, :work_status, :update_time) json.student_score work_score_format(anon_comments(@current_user, work.id).last.try(:score), false, true) # json.student_comment_count anon_comments(@current_user, work.id).count + + # 申诉条数 + if @homework.anonymous_appeal + json.appeal_all_count work.my_appeal_all_count @current_user.id + json.appeal_deal_count work.my_appeal_deal_count @current_user.id + end else json.(work, :id, :work_status, :update_time, :work_score, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :ultimate_score) json.late_penalty work.late_penalty if @homework.allow_late - json.work_score work_score_format(work.work_score, @current_user == work.user, @homework.score_open) - json.final_score work_score_format(work.final_score, @current_user == work.user, @homework.score_open) - json.teacher_score work_score_format(work.teacher_score, @current_user == work.user, @homework.score_open) - json.student_score work_score_format(work.student_score, @current_user == work.user, @homework.score_open) - json.teaching_asistant_score work_score_format(work.teaching_asistant_score, @current_user == work.user, @homework.score_open) + json.work_score work_score_format(work.work_score, @current_user == work.user, @score_open) + json.final_score work_score_format(work.final_score, @current_user == work.user, @score_open) + json.teacher_score work_score_format(work.teacher_score, @current_user == work.user, @score_open) + json.student_score work_score_format(work.student_score, @current_user == work.user, @score_open) + json.teaching_asistant_score work_score_format(work.teaching_asistant_score, @current_user == work.user, @score_open) # 助教评分次数 json.ta_comment_count work.ta_comment_count @@ -135,13 +140,13 @@ elsif @homework.homework_type == "group" || @homework.homework_type == "normal" end json.work_group work.work_group_name end - end - # 申诉条数 - if @homework.anonymous_appeal - json.appeal_all_count work.appeal_all_count - json.appeal_deal_count work.appeal_deal_count - json.appeal_penalty work.appeal_penalty + # 申诉条数 + if @homework.anonymous_appeal + json.appeal_all_count work.appeal_all_count + json.appeal_deal_count work.appeal_deal_count + json.appeal_penalty work.appeal_penalty + end end json.user_login @is_evaluation ? "--" : work.user.try(:login) diff --git a/app/views/polls/commit_result.xlsx.axlsx b/app/views/polls/commit_result.xlsx.axlsx index ce1817f76..3ea0571cb 100644 --- a/app/views/polls/commit_result.xlsx.axlsx +++ b/app/views/polls/commit_result.xlsx.axlsx @@ -1,16 +1,14 @@ wb = xlsx_package.workbook -wb.use_autowidth = false +# wb.use_autowidth = false wb.styles do |s| - sz_all = s.add_style :sz => 10,:border => { :style => :thin, :color =>"000000"},:alignment => {:horizontal => :left} - blue_cell = s.add_style :bg_color => "FAEBDC", :sz => 10,:height => 20,:b => true, :border => { :style => :thin, :color =>"000000" },:alignment => {:horizontal => :left} + sz_all = s.add_style :sz => 10,:border => { :style => :thin, :color =>"000000"},:alignment => {wrap_text: true,:horizontal => :left} + blue_cell = s.add_style :bg_color => "FAEBDC", :sz => 10,:height => 20,:b => true, :border => { :style => :thin, :color =>"000000" },:alignment => {wrap_text: true,:horizontal => :left} wb.add_worksheet(:name => "统计结果") do |sheet| sheet.sheet_view.show_grid_lines = false poll_users_info = %w(序号) poll_ques_titles = poll_questions.pluck(:question_title).map {|k| strip_export_title(k) if k.present?} - - poll_ques_ids = poll_questions.pluck(:id).sort #问题的全部id poll_un_anony = @poll.un_anonymous if poll_un_anony #是否匿名,默认为false user_info = %w(登陆名 真实姓名 邮箱 学号) @@ -32,25 +30,25 @@ wb.styles do |s| sheet_answer_row.push(answer_users_count) sheet_answer_percent.push(answer_percent.to_s) end - sheet.add_row sheet_row, :style => blue_cell - sheet.add_row sheet_answer_row, :style => sz_all - sheet.add_row sheet_answer_percent, :style => sz_all - sheet.add_row sheet_answer_useful, :style => sz_all + sheet.add_row sheet_row, :height =>15,:style => blue_cell + sheet.add_row sheet_answer_row, :height =>15, :style => sz_all + sheet.add_row sheet_answer_percent, :height =>15, :style => sz_all + sheet.add_row sheet_answer_useful, :height =>15, :style => sz_all #合并单元格,但无法填充style # sheet.merge_cells (Axlsx::cell_r(1,sheet.rows.last.row_index) + ':' + Axlsx::cell_r(sheet_row.count-1,sheet.rows.last.row_index)) # sheet.rows[sheet.rows.last.row_index].style = sz_all sheet.add_row [] else #主观题答案 main_show_row = ["第#{q.question_number}题",q.question_title] - sheet.add_row main_show_row, :style => blue_cell + sheet.add_row main_show_row,:height =>15, :style => blue_cell q.poll_votes.each do |v| #主观题的答案 - sheet.add_row ["",v.vote_text.present? ? v.vote_text : "--"], :style => sz_all + sheet.add_row ["",v.vote_text.present? ? v.vote_text : "--"],:height =>15, :style => sz_all end sheet.add_row [], :style => sz_all end end #each_with_index - sheet.add_row poll_users_info, :style => blue_cell + sheet.add_row poll_users_info, :height =>15, :style => blue_cell @poll.poll_users.each_with_index do |u,index| u_user = u.user user_answer_array = [] @@ -88,7 +86,7 @@ wb.styles do |s| user_cell += [user_login,user_name, u_user.mail, user_student_id] end all_user_cell = user_cell + user_answer_array - sheet.add_row all_user_cell, :style => sz_all + sheet.add_row all_user_cell, :height =>15,:style => sz_all end sheet.column_widths *([25]*sheet.column_info.count) sheet.column_info.first.width = 10 diff --git a/app/views/polls/poll_lists.json.jbuilder b/app/views/polls/poll_lists.json.jbuilder index f134967c9..1ebccffeb 100644 --- a/app/views/polls/poll_lists.json.jbuilder +++ b/app/views/polls/poll_lists.json.jbuilder @@ -1,7 +1,6 @@ json.course do json.partial! "polls/course_name",locals:{course:@course} end - json.poll_types do if @poll_current_user_status == 0 json.published_count @poll_publish_count diff --git a/app/views/shixuns/add_collaborators.json.jbuilder b/app/views/shixuns/add_collaborators.json.jbuilder index ab4716681..3fc341b69 100644 --- a/app/views/shixuns/add_collaborators.json.jbuilder +++ b/app/views/shixuns/add_collaborators.json.jbuilder @@ -1,7 +1,8 @@ #json.partial! "users/users_list", users: @users +json.user_count @users_count json.array! @users do |user| json.user_id user.id json.identify user.identity - json.nickname user.nickname + json.nickname user.real_name json.school_name user.school_name -end \ No newline at end of file +end diff --git a/app/views/shixuns/send_to_course.json.jbuilder b/app/views/shixuns/send_to_course.json.jbuilder index dd087d3e2..b2e30f985 100644 --- a/app/views/shixuns/send_to_course.json.jbuilder +++ b/app/views/shixuns/send_to_course.json.jbuilder @@ -1,4 +1,3 @@ json.status 1 json.message "发送成功" -json.url course_homework_commons_path(@course.id, type: 4) -# json.url "#{Rails::configuration.educoder['old_edu_host']}/homework_common?course=#{@course.id}&homework_type=4" \ No newline at end of file +json.course_id @course.id \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index ecd54c8c0..f81d90267 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -117,6 +117,7 @@ Rails.application.routes.draw do get :close_webssh get :get_answer_info get :unlock_answer + get :check_test_sets end collection do diff --git a/config/sidekiq.yml b/config/sidekiq.yml index a2b3fc0be..5bd9dad23 100644 --- a/config/sidekiq.yml +++ b/config/sidekiq.yml @@ -3,4 +3,6 @@ :logfile: log/sidekiq.log :queues: - [default, 3] + - [score, 4] + - [evaluation_comment, 5] - [notify, 100] \ No newline at end of file diff --git a/db/migrate/20190627012118_modify_quotes_for_gtopic_banks.rb b/db/migrate/20190627012118_modify_quotes_for_gtopic_banks.rb new file mode 100644 index 000000000..a47157414 --- /dev/null +++ b/db/migrate/20190627012118_modify_quotes_for_gtopic_banks.rb @@ -0,0 +1,6 @@ +class ModifyQuotesForGtopicBanks < ActiveRecord::Migration[5.2] + def change + GtopicBank.where("quotes is null").update_all(:quotes => 0) + change_column :gtopic_banks, :quotes, :integer, :default => 0 + end +end diff --git a/lib/gitcheck/myshixun_update_error.txt b/lib/gitcheck/myshixun_update_error.txt new file mode 100644 index 000000000..e69de29bb diff --git a/lib/gitcheck/readme_test.txt b/lib/gitcheck/readme_test.txt index 03f757f18..317af632c 100644 --- a/lib/gitcheck/readme_test.txt +++ b/lib/gitcheck/readme_test.txt @@ -22,7 +22,7 @@ http://121.199.19.206:9000/api/fork_repository 参数: {repo_path: 'Hjqreturn/aaass1.git', fork_repository_path: 'educoder/ca9fvobr.git'} - 说明:fork_repository_path是源项目的repo_path, repo_path是新项目的 + 说明:fork_repository_path是新项目的repo_path, repo_path是源项目的 4、更新文件 @@ -41,7 +41,7 @@ 5、获取文件内容 访问地址:http://121.199.19.206:9000/api/file_content 参数: - {repo_path: "educoder/ca9fvobr.git", file_path: 'step1/main.py',} + {repo_path: "educoder/ca9fvobr.git", path: 'step1/main.py',} 6、获取提交记录 访问地址:http://121.199.19.206:9000/api/commits diff --git a/lib/gitcheck/shixun_update.txt b/lib/gitcheck/shixun_update.txt index e69de29bb..ff5e54236 100644 --- a/lib/gitcheck/shixun_update.txt +++ b/lib/gitcheck/shixun_update.txt @@ -0,0 +1,563 @@ +http://testbdgit2.educoder.net/educoder/mqex9s82.git +http://testbdgit2.educoder.net/educoder/nf9ja46l.git +http://testbdgit2.educoder.net/educoder/qmeb65oa.git +http://testbdgit2.educoder.net/educoder/748fkcya.git +http://testbdgit2.educoder.net/educoder/o7pr4f6v.git +http://testbdgit2.educoder.net/educoder/tjxnyuv6.git +http://testbdgit2.educoder.net/educoder/fp6cmstz.git +http://testbdgit2.educoder.net/educoder/eh5oxkm9.git +http://testbdgit2.educoder.net/educoder/uznmbg54.git +http://testbdgit2.educoder.net/educoder/i8utopmc.git +http://testbdgit2.educoder.net/educoder/f9ly35vz.git +http://testbdgit2.educoder.net/educoder/vnw2fg5r.git +http://testbdgit2.educoder.net/educoder/pcfhzue5.git +http://testbdgit2.educoder.net/educoder/zlg2nmcf.git +http://testbdgit2.educoder.net/educoder/klp26sqc.git +http://testbdgit2.educoder.net/educoder/y68uqmoe.git +http://testbdgit2.educoder.net/educoder/7zg5mi2r.git +http://testbdgit2.educoder.net/educoder/8g93nfvc.git +http://testbdgit2.educoder.net/educoder/mnj3srpe.git +http://testbdgit2.educoder.net/educoder/lrwsyhzc.git +http://testbdgit2.educoder.net/educoder/a2ct98o7.git +http://testbdgit2.educoder.net/educoder/hawxspqm.git +http://testbdgit2.educoder.net/educoder/pobfl4g8.git +http://testbdgit2.educoder.net/educoder/zg7e9o2y.git +http://testbdgit2.educoder.net/educoder/fsu7tkaw.git +http://testbdgit2.educoder.net/educoder/cmklt4f8.git +http://testbdgit2.educoder.net/educoder/2gt3yuen.git +http://testbdgit2.educoder.net/educoder/v3bksozu.git +http://testbdgit2.educoder.net/educoder/ku6lva8t.git +http://testbdgit2.educoder.net/educoder/g8w3nj6r.git +http://testbdgit2.educoder.net/educoder/pxlsuotc.git +http://testbdgit2.educoder.net/educoder/opv8xkjw.git +http://testbdgit2.educoder.net/educoder/stewl573.git +http://testbdgit2.educoder.net/educoder/nuj9lbwv.git +http://testbdgit2.educoder.net/educoder/r4vlju5x.git +http://testbdgit2.educoder.net/educoder/85fat9w3.git +http://testbdgit2.educoder.net/educoder/guzqi4nm.git +http://testbdgit2.educoder.net/educoder/obtfwj3e.git +http://testbdgit2.educoder.net/educoder/3ozvy5f8.git +http://testbdgit2.educoder.net/educoder/8bu9zmjy.git +http://testbdgit2.educoder.net/educoder/n489y7qt.git +http://testbdgit2.educoder.net/educoder/f3pwvrtk.git +http://testbdgit2.educoder.net/educoder/b6ljcet3.git +http://testbdgit2.educoder.net/educoder/uie9snqp.git +http://testbdgit2.educoder.net/educoder/xti6ueyf.git +http://testbdgit2.educoder.net/educoder/gwkc395l.git +http://testbdgit2.educoder.net/educoder/6a2qy98p.git +http://testbdgit2.educoder.net/educoder/2qffg3pu.git +http://testbdgit2.educoder.net/educoder/nfypjxhl.git +http://testbdgit2.educoder.net/educoder/9p4neovc.git +http://testbdgit2.educoder.net/educoder/k4wg9b32.git +http://testbdgit2.educoder.net/educoder/pw53ln4m.git +http://testbdgit2.educoder.net/educoder/cylj7vgb.git +http://testbdgit2.educoder.net/educoder/ftfzbw72.git +http://testbdgit2.educoder.net/educoder/qt78x4a5.git +http://testbdgit2.educoder.net/educoder/qsza57pj.git +http://testbdgit2.educoder.net/educoder/afvk9r35.git +http://testbdgit2.educoder.net/educoder/68rqajhy.git +http://testbdgit2.educoder.net/educoder/q4ixftoz.git +http://testbdgit2.educoder.net/educoder/pbmkl5vt.git +http://testbdgit2.educoder.net/educoder/ral8fjw9.git +http://testbdgit2.educoder.net/educoder/89zfsjbp.git +http://testbdgit2.educoder.net/educoder/no9uv3g2.git +http://testbdgit2.educoder.net/educoder/cztux23y.git +http://testbdgit2.educoder.net/educoder/4bflgcs8.git +http://testbdgit2.educoder.net/educoder/6w2xmtls.git +http://testbdgit2.educoder.net/educoder/o4xa93mc.git +http://testbdgit2.educoder.net/educoder/uctzevfx.git +http://testbdgit2.educoder.net/educoder/wokspmut.git +http://testbdgit2.educoder.net/educoder/ba56rk8v.git +http://testbdgit2.educoder.net/educoder/6w49utr2.git +http://testbdgit2.educoder.net/educoder/qnubm248.git +http://testbdgit2.educoder.net/educoder/itzexlbn.git +http://testbdgit2.educoder.net/educoder/e6o9pmz4.git +http://testbdgit2.educoder.net/educoder/qr9fhylp.git +http://testbdgit2.educoder.net/educoder/q2nya3cj.git +http://testbdgit2.educoder.net/educoder/58drwg63.git +http://testbdgit2.educoder.net/educoder/oiwsvgpf.git +http://testbdgit2.educoder.net/educoder/4uyn5ebp.git +http://testbdgit2.educoder.net/educoder/pebvjtk9.git +http://testbdgit2.educoder.net/educoder/uywljq4v.git +http://testbdgit2.educoder.net/educoder/zawfjtnm.git +http://testbdgit2.educoder.net/educoder/z5w3gbhk.git +http://testbdgit2.educoder.net/educoder/cz7yw3en.git +http://testbdgit2.educoder.net/educoder/p87sflg2.git +http://testbdgit2.educoder.net/educoder/w3vcokrg.git +http://testbdgit2.educoder.net/educoder/uc64f2qs.git +http://testbdgit2.educoder.net/educoder/vtnag4op.git +http://testbdgit2.educoder.net/educoder/mbgfitn6.git +http://testbdgit2.educoder.net/educoder/nwj4ua2k.git +http://testbdgit2.educoder.net/educoder/y8kfhtu6.git +http://testbdgit2.educoder.net/educoder/tmivlph2.git +http://testbdgit2.educoder.net/educoder/ziyft572.git +http://testbdgit2.educoder.net/educoder/k8u4nrj6.git +http://testbdgit2.educoder.net/educoder/wgfyrzhe.git +http://testbdgit2.educoder.net/educoder/a4ts237c.git +http://testbdgit2.educoder.net/educoder/cvw63y9e.git +http://testbdgit2.educoder.net/educoder/bxltfpa5.git +http://testbdgit2.educoder.net/educoder/x2anczf5.git +http://testbdgit2.educoder.net/educoder/m57iyhan.git +http://testbdgit2.educoder.net/educoder/iqrakwl2.git +http://testbdgit2.educoder.net/educoder/fagcx7yl.git +http://testbdgit2.educoder.net/educoder/oxlpy9uq.git +http://testbdgit2.educoder.net/educoder/6spm2y7k.git +http://testbdgit2.educoder.net/educoder/6fxzts5b.git +http://testbdgit2.educoder.net/eduforge/fhc7p56a.git +http://testbdgit2.educoder.net/eduforge/3aexl5my.git +http://testbdgit2.educoder.net/educoder/9mz7qn5t.git +http://testbdgit2.educoder.net/educoder/b9r8pon3.git +http://testbdgit2.educoder.net/educoder/ciz68os9.git +http://testbdgit2.educoder.net/educoder/2e4fuw87.git +http://testbdgit2.educoder.net/educoder/hwm9s64y.git +http://testbdgit2.educoder.net/educoder/owsik483.git +http://testbdgit2.educoder.net/educoder/pbt9cyfo.git +http://testbdgit2.educoder.net/educoder/8u4fvn9w.git +http://testbdgit2.educoder.net/educoder/5bpkg3e6.git +http://testbdgit2.educoder.net/educoder/ohkunqe2.git +http://testbdgit2.educoder.net/educoder/u3j28qe6.git +http://testbdgit2.educoder.net/educoder/yjo3t72c.git +http://testbdgit2.educoder.net/educoder/oy7prsxe.git +http://testbdgit2.educoder.net/educoder/q3ljmkn2.git +http://testbdgit2.educoder.net/educoder/gk6lhtrf.git +http://testbdgit2.educoder.net/eduforge/v6pa2kiz.git +http://testbdgit2.educoder.net/educoder/qpuobn24.git +http://testbdgit2.educoder.net/educoder/mkxfysza.git +http://testbdgit2.educoder.net/eduforge/hpr7ojgc.git +http://testbdgit2.educoder.net/educoder/2aef9wni.git +http://testbdgit2.educoder.net/eduforge/8texrqwj.git +http://testbdgit2.educoder.net/educoder/wle7zmxu.git +http://testbdgit2.educoder.net/eduforge/j7cx68b9.git +http://testbdgit2.educoder.net/educoder/ywrcjki2.git +http://testbdgit2.educoder.net/educoder/sauvl9px.git +http://testbdgit2.educoder.net/educoder/3pl6j2me.git +http://testbdgit2.educoder.net/eduforge/o53rjgsh.git +http://testbdgit2.educoder.net/educoder/g8znf6cy.git +http://testbdgit2.educoder.net/educoder/itk4hy6l.git +http://testbdgit2.educoder.net/eduforge/igbc4rtw.git +http://testbdgit2.educoder.net/educoder/mnkfuyvx.git +http://testbdgit2.educoder.net/educoder/oatsh64e.git +http://testbdgit2.educoder.net/educoder/2mgsyrnu.git +http://testbdgit2.educoder.net/educoder/69ulmat5.git +http://testbdgit2.educoder.net/eduforge/9z3k5i4f.git +http://testbdgit2.educoder.net/educoder/7bysthvr.git +http://testbdgit2.educoder.net/eduforge/z3wh7uex.git +http://testbdgit2.educoder.net/educoder/9o5h2rsf.git +http://testbdgit2.educoder.net/educoder/uf3gl2vq.git +http://testbdgit2.educoder.net/eduforge/jef9xvzb.git +http://testbdgit2.educoder.net/educoder/g94qce7p.git +http://testbdgit2.educoder.net/educoder/2a54vk8x.git +http://testbdgit2.educoder.net/educoder/sx5eukfq.git +http://testbdgit2.educoder.net/educoder/ivzjw793.git +http://testbdgit2.educoder.net/eduforge/aekgf6pz.git +http://testbdgit2.educoder.net/educoder/tzqbu6c4.git +http://testbdgit2.educoder.net/educoder/ovz3e6a7.git +http://testbdgit2.educoder.net/educoder/ujavffi2.git +http://testbdgit2.educoder.net/educoder/8jsxcfm5.git +http://testbdgit2.educoder.net/educoder/qgpycjvn.git +http://testbdgit2.educoder.net/educoder/rhasift3.git +http://testbdgit2.educoder.net/educoder/nfpla5jg.git +http://testbdgit2.educoder.net/educoder/bjo2x4c9.git +http://testbdgit2.educoder.net/educoder/3jawxy9g.git +http://testbdgit2.educoder.net/eduforge/h6gs8t7q.git +http://testbdgit2.educoder.net/educoder/ntexhzrl.git +http://testbdgit2.educoder.net/educoder/jft327sa.git +http://testbdgit2.educoder.net/educoder/7bvs54gw.git +http://testbdgit2.educoder.net/educoder/grunzcs3.git +http://testbdgit2.educoder.net/educoder/q4fowkfa.git +http://testbdgit2.educoder.net/educoder/fkmtrpsn.git +http://testbdgit2.educoder.net/educoder/2iubzxfh.git +http://testbdgit2.educoder.net/educoder/gbhwvrki.git +http://testbdgit2.educoder.net/educoder/kpxfs4b5.git +http://testbdgit2.educoder.net/educoder/h5f6wi7x.git +http://testbdgit2.educoder.net/educoder/c3lr2xjz.git +http://testbdgit2.educoder.net/educoder/q8bcyxz3.git +http://testbdgit2.educoder.net/educoder/qha5emif.git +http://testbdgit2.educoder.net/educoder/5jr4gzs7.git +http://testbdgit2.educoder.net/educoder/9ksg4up7.git +http://testbdgit2.educoder.net/educoder/4rcxvftu.git +http://testbdgit2.educoder.net/educoder/hvaf5txj.git +http://testbdgit2.educoder.net/educoder/b4vqe8uz.git +http://testbdgit2.educoder.net/educoder/pg6c2i5y.git +http://testbdgit2.educoder.net/educoder/fbtlw8ro.git +http://testbdgit2.educoder.net/educoder/86f92lri.git +http://testbdgit2.educoder.net/educoder/zvaup9yo.git +http://testbdgit2.educoder.net/educoder/exm3ffap.git +http://testbdgit2.educoder.net/educoder/owg63ezu.git +http://testbdgit2.educoder.net/educoder/c36opqaj.git +http://testbdgit2.educoder.net/educoder/xuyrc6qs.git +http://testbdgit2.educoder.net/educoder/xc9tj82p.git +http://testbdgit2.educoder.net/educoder/nmougtya.git +http://testbdgit2.educoder.net/educoder/8arufxzl.git +http://testbdgit2.educoder.net/educoder/m7nrf6zf.git +http://testbdgit2.educoder.net/educoder/zffu9j6v.git +http://testbdgit2.educoder.net/educoder/epmtoh6b.git +http://testbdgit2.educoder.net/educoder/ejab7vxn.git +http://testbdgit2.educoder.net/educoder/83lyhsen.git +http://testbdgit2.educoder.net/educoder/m4e6x573.git +http://testbdgit2.educoder.net/educoder/unfihtsv.git +http://testbdgit2.educoder.net/educoder/74ftapwb.git +http://testbdgit2.educoder.net/educoder/iu47m9qx.git +http://testbdgit2.educoder.net/educoder/8bh6mfu3.git +http://testbdgit2.educoder.net/educoder/sb26oath.git +http://testbdgit2.educoder.net/educoder/igvm3fsb.git +http://testbdgit2.educoder.net/educoder/gancv2yo.git +http://testbdgit2.educoder.net/educoder/kyp65jwu.git +http://testbdgit2.educoder.net/educoder/6ru2nbpj.git +http://testbdgit2.educoder.net/educoder/rfpwhsu5.git +http://testbdgit2.educoder.net/educoder/orem2wgc.git +http://testbdgit2.educoder.net/educoder/yuhmfliq.git +http://testbdgit2.educoder.net/educoder/m4c7jo6y.git +http://testbdgit2.educoder.net/educoder/5l6oufzc.git +http://testbdgit2.educoder.net/educoder/my7vcffx.git +http://testbdgit2.educoder.net/educoder/uvka63xs.git +http://testbdgit2.educoder.net/educoder/c9thq3li.git +http://testbdgit2.educoder.net/educoder/o45rn2sl.git +http://testbdgit2.educoder.net/educoder/sae3fyjc.git +http://testbdgit2.educoder.net/educoder/56orxtg3.git +http://testbdgit2.educoder.net/educoder/cqpzx47f.git +http://testbdgit2.educoder.net/educoder/2in3vcf7.git +http://testbdgit2.educoder.net/educoder/6isfgtun.git +http://testbdgit2.educoder.net/educoder/46woubzq.git +http://testbdgit2.educoder.net/educoder/6xwmi29f.git +http://testbdgit2.educoder.net/educoder/hk968fua.git +http://testbdgit2.educoder.net/educoder/ogb6ixjz.git +http://testbdgit2.educoder.net/educoder/va7cru64.git +http://testbdgit2.educoder.net/educoder/vqnk5tjo.git +http://testbdgit2.educoder.net/educoder/oqfsci8u.git +http://testbdgit2.educoder.net/educoder/qcosi4f8.git +http://testbdgit2.educoder.net/educoder/bsnk7wit.git +http://testbdgit2.educoder.net/educoder/ksvmtwql.git +http://testbdgit2.educoder.net/educoder/eigqpfua.git +http://testbdgit2.educoder.net/educoder/hqmwxztb.git +http://testbdgit2.educoder.net/educoder/jlgt9wfk.git +http://testbdgit2.educoder.net/educoder/hcuzqkgv.git +http://testbdgit2.educoder.net/educoder/hzw89pof.git +http://testbdgit2.educoder.net/educoder/xnft4fsm.git +http://testbdgit2.educoder.net/educoder/guj4ml8q.git +http://testbdgit2.educoder.net/educoder/l56jkwfn.git +http://testbdgit2.educoder.net/educoder/4jqry5gl.git +http://testbdgit2.educoder.net/educoder/65kiwb72.git +http://testbdgit2.educoder.net/educoder/xb39mzfr.git +http://testbdgit2.educoder.net/educoder/hyb5m38x.git +http://testbdgit2.educoder.net/educoder/p4f2jtkq.git +http://testbdgit2.educoder.net/educoder/4n3stcol.git +http://testbdgit2.educoder.net/educoder/6kjqar5e.git +http://testbdgit2.educoder.net/educoder/qhc2prk4.git +http://testbdgit2.educoder.net/educoder/ltw8b29i.git +http://testbdgit2.educoder.net/educoder/g5y8zcvl.git +http://testbdgit2.educoder.net/educoder/5et7zpra.git +http://testbdgit2.educoder.net/educoder/au97mpbr.git +http://testbdgit2.educoder.net/educoder/oxmt2zvc.git +http://testbdgit2.educoder.net/educoder/26chou4y.git +http://testbdgit2.educoder.net/educoder/lfmus7o2.git +http://testbdgit2.educoder.net/educoder/efbp7luz.git +http://testbdgit2.educoder.net/educoder/7lr8agws.git +http://testbdgit2.educoder.net/educoder/ak8tbjuv.git +http://testbdgit2.educoder.net/educoder/qu8a93ew.git +http://testbdgit2.educoder.net/educoder/zlgfiowe.git +http://testbdgit2.educoder.net/educoder/qmt4nfai.git +http://testbdgit2.educoder.net/educoder/u2s4v9ba.git +http://testbdgit2.educoder.net/educoder/2icxsunf.git +http://testbdgit2.educoder.net/educoder/fzmqjp6g.git +http://testbdgit2.educoder.net/educoder/7ir3vmzw.git +http://testbdgit2.educoder.net/educoder/xkfzg96o.git +http://testbdgit2.educoder.net/educoder/xvfl5sjz.git +http://testbdgit2.educoder.net/educoder/qnwuy7h3.git +http://testbdgit2.educoder.net/educoder/bhnspvmg.git +http://testbdgit2.educoder.net/educoder/ns7vh6ro.git +http://testbdgit2.educoder.net/eduforge/un3xoal7.git +http://testbdgit2.educoder.net/educoder/29am7wv4.git +http://testbdgit2.educoder.net/educoder/qlfn5hiu.git +http://testbdgit2.educoder.net/educoder/e4pvkhtj.git +http://testbdgit2.educoder.net/educoder/hfesmtuz.git +http://testbdgit2.educoder.net/educoder/6kjhil3m.git +http://testbdgit2.educoder.net/educoder/2igrh8c4.git +http://testbdgit2.educoder.net/educoder/e7yt3kmw.git +http://testbdgit2.educoder.net/educoder/a8zybrkt.git +http://testbdgit2.educoder.net/educoder/v2uzrasj.git +http://testbdgit2.educoder.net/educoder/rb83htif.git +http://testbdgit2.educoder.net/eduforge/jc3p2wto.git +http://testbdgit2.educoder.net/educoder/jtnlfgw2.git +http://testbdgit2.educoder.net/educoder/fa96xrti.git +http://testbdgit2.educoder.net/educoder/r6bjga3u.git +http://testbdgit2.educoder.net/educoder/fpmwzxqn.git +http://testbdgit2.educoder.net/educoder/rbpsw8ct.git +http://testbdgit2.educoder.net/educoder/4zuxembp.git +http://testbdgit2.educoder.net/educoder/3gxwrzaf.git +http://testbdgit2.educoder.net/educoder/wz6j5lpn.git +http://testbdgit2.educoder.net/educoder/izu9tf3j.git +http://testbdgit2.educoder.net/educoder/vhux4pa7.git +http://testbdgit2.educoder.net/educoder/s9wvroqn.git +http://testbdgit2.educoder.net/educoder/ruofj2xl.git +http://testbdgit2.educoder.net/educoder/qj4mlxoi.git +http://testbdgit2.educoder.net/educoder/34gzbolc.git +http://testbdgit2.educoder.net/educoder/at86wfsn.git +http://testbdgit2.educoder.net/educoder/j7fnwsrh.git +http://testbdgit2.educoder.net/educoder/zgsuk364.git +http://testbdgit2.educoder.net/educoder/nf3gv54x.git +http://testbdgit2.educoder.net/educoder/fnbuq957.git +http://testbdgit2.educoder.net/educoder/z4fp9o3e.git +http://testbdgit2.educoder.net/educoder/c3qh4p6f.git +http://testbdgit2.educoder.net/educoder/fszntcbw.git +http://testbdgit2.educoder.net/educoder/af968lnf.git +http://testbdgit2.educoder.net/educoder/kpc36fhn.git +http://testbdgit2.educoder.net/educoder/6c4wp5bu.git +http://testbdgit2.educoder.net/educoder/hzmikncs.git +http://testbdgit2.educoder.net/educoder/6ogr4bhj.git +http://testbdgit2.educoder.net/educoder/fu59rezf.git +http://testbdgit2.educoder.net/educoder/zef9gswv.git +http://testbdgit2.educoder.net/educoder/p9z4fxv8.git +http://testbdgit2.educoder.net/eduforge/hcxeuyfl.git +http://testbdgit2.educoder.net/educoder/4u2ebx89.git +http://testbdgit2.educoder.net/educoder/cikojzsb.git +http://testbdgit2.educoder.net/educoder/2rzomtx5.git +http://testbdgit2.educoder.net/educoder/wfvbhr2s.git +http://testbdgit2.educoder.net/educoder/q8mxg4zv.git +http://testbdgit2.educoder.net/educoder/q8fezi37.git +http://testbdgit2.educoder.net/educoder/nb7ha8te.git +http://testbdgit2.educoder.net/educoder/qxgfbyn9.git +http://testbdgit2.educoder.net/educoder/k8so9wa2.git +http://testbdgit2.educoder.net/educoder/zwc9ja5y.git +http://testbdgit2.educoder.net/educoder/89lwscfy.git +http://testbdgit2.educoder.net/educoder/ga26fy4f.git +http://testbdgit2.educoder.net/educoder/rgy4769i.git +http://testbdgit2.educoder.net/educoder/q3rnovik.git +http://testbdgit2.educoder.net/educoder/r5xsukn4.git +http://testbdgit2.educoder.net/educoder/yu6za47j.git +http://testbdgit2.educoder.net/educoder/fqvr56nm.git +http://testbdgit2.educoder.net/educoder/tq26m73o.git +http://testbdgit2.educoder.net/educoder/k2rmpuf6.git +http://testbdgit2.educoder.net/educoder/fzg87ip6.git +http://testbdgit2.educoder.net/educoder/qk3l64zi.git +http://testbdgit2.educoder.net/educoder/bcjpk93f.git +http://testbdgit2.educoder.net/educoder/rnjak48l.git +http://testbdgit2.educoder.net/educoder/hyzkq5vr.git +http://testbdgit2.educoder.net/educoder/tqnvbisr.git +http://testbdgit2.educoder.net/educoder/nfszy26f.git +http://testbdgit2.educoder.net/educoder/rfnhkvgo.git +http://testbdgit2.educoder.net/educoder/6omf2gbl.git +http://testbdgit2.educoder.net/educoder/x4qhb5k7.git +http://testbdgit2.educoder.net/educoder/jyz63ge5.git +http://testbdgit2.educoder.net/educoder/hfqwilp3.git +http://testbdgit2.educoder.net/educoder/aq9c4fy5.git +http://testbdgit2.educoder.net/educoder/tzshnbl8.git +http://testbdgit2.educoder.net/educoder/zm8qffrj.git +http://testbdgit2.educoder.net/educoder/szctor3e.git +http://testbdgit2.educoder.net/educoder/amcyzpvk.git +http://testbdgit2.educoder.net/educoder/fpy467o9.git +http://testbdgit2.educoder.net/educoder/w5nytxec.git +http://testbdgit2.educoder.net/educoder/icreqzu4.git +http://testbdgit2.educoder.net/educoder/2jf76xr5.git +http://testbdgit2.educoder.net/educoder/yl4a2qf5.git +http://testbdgit2.educoder.net/educoder/jgmcieqk.git +http://testbdgit2.educoder.net/educoder/hjtxy657.git +http://testbdgit2.educoder.net/educoder/47w6uyeh.git +http://testbdgit2.educoder.net/educoder/pr4vg7j5.git +http://testbdgit2.educoder.net/educoder/m6xn7z93.git +http://testbdgit2.educoder.net/educoder/f23fge9h.git +http://testbdgit2.educoder.net/educoder/cfo7lqhs.git +http://testbdgit2.educoder.net/educoder/4gnkqf3y.git +http://testbdgit2.educoder.net/educoder/k89bgonj.git +http://testbdgit2.educoder.net/educoder/k98qr7iw.git +http://testbdgit2.educoder.net/educoder/jel85v62.git +http://testbdgit2.educoder.net/educoder/zt2aqnb6.git +http://testbdgit2.educoder.net/educoder/7icqubfj.git +http://testbdgit2.educoder.net/educoder/2x59s3by.git +http://testbdgit2.educoder.net/educoder/mrvwxekj.git +http://testbdgit2.educoder.net/educoder/k5cruoyp.git +http://testbdgit2.educoder.net/educoder/rc6hw58u.git +http://testbdgit2.educoder.net/educoder/ygzf7v3k.git +http://testbdgit2.educoder.net/educoder/8ty6fgln.git +http://testbdgit2.educoder.net/educoder/wp5mbjg8.git +http://testbdgit2.educoder.net/educoder/oniuafxz.git +http://testbdgit2.educoder.net/educoder/aviljpmn.git +http://testbdgit2.educoder.net/educoder/iufg8573.git +http://testbdgit2.educoder.net/educoder/gc8xl2v9.git +http://testbdgit2.educoder.net/educoder/2wgmhvuk.git +http://testbdgit2.educoder.net/educoder/clx7ha6j.git +http://testbdgit2.educoder.net/educoder/bz9wxpvr.git +http://testbdgit2.educoder.net/educoder/uw95cg28.git +http://testbdgit2.educoder.net/educoder/4frpc7ix.git +http://testbdgit2.educoder.net/educoder/nas3v78t.git +http://testbdgit2.educoder.net/educoder/cbrys8f3.git +http://testbdgit2.educoder.net/educoder/ofj29enq.git +http://testbdgit2.educoder.net/educoder/btvk2w5h.git +http://testbdgit2.educoder.net/educoder/cztbjan5.git +http://testbdgit2.educoder.net/educoder/7atfm9vu.git +http://testbdgit2.educoder.net/educoder/cpxs3kfu.git +http://testbdgit2.educoder.net/educoder/5pfalzkh.git +http://testbdgit2.educoder.net/educoder/yf6covh2.git +http://testbdgit2.educoder.net/educoder/ocevha8x.git +http://testbdgit2.educoder.net/educoder/qtxkogfi.git +http://testbdgit2.educoder.net/educoder/pa8fh4m2.git +http://testbdgit2.educoder.net/educoder/n3ps8i4m.git +http://testbdgit2.educoder.net/educoder/5x9alvmc.git +http://testbdgit2.educoder.net/educoder/yl732ofk.git +http://testbdgit2.educoder.net/educoder/hvlgfjb7.git +http://testbdgit2.educoder.net/educoder/i9sfum58.git +http://testbdgit2.educoder.net/educoder/my9jcvio.git +http://testbdgit2.educoder.net/educoder/2myqxbce.git +http://testbdgit2.educoder.net/educoder/p4x9qmka.git +http://testbdgit2.educoder.net/educoder/aslcogwk.git +http://testbdgit2.educoder.net/educoder/eryg8fot.git +http://testbdgit2.educoder.net/educoder/ust5hgjm.git +http://testbdgit2.educoder.net/educoder/ypve8gbo.git +http://testbdgit2.educoder.net/educoder/ir768pfq.git +http://testbdgit2.educoder.net/educoder/ki98yelu.git +http://testbdgit2.educoder.net/educoder/i4nzvb7x.git +http://testbdgit2.educoder.net/educoder/58l7vb9f.git +http://testbdgit2.educoder.net/educoder/l859pqs3.git +http://testbdgit2.educoder.net/educoder/6rvpzn7x.git +http://testbdgit2.educoder.net/educoder/c5msxfe8.git +http://testbdgit2.educoder.net/educoder/cwa6igze.git +http://testbdgit2.educoder.net/educoder/vbnqglcw.git +http://testbdgit2.educoder.net/educoder/8bysvmcf.git +http://testbdgit2.educoder.net/educoder/u3ceh2xw.git +http://testbdgit2.educoder.net/educoder/heqtnza3.git +http://testbdgit2.educoder.net/educoder/uzoltjva.git +http://testbdgit2.educoder.net/educoder/mefykafs.git +http://testbdgit2.educoder.net/educoder/6jvypwgq.git +http://testbdgit2.educoder.net/educoder/h5wisac9.git +http://testbdgit2.educoder.net/educoder/52ufjw9m.git +http://testbdgit2.educoder.net/educoder/v2uxoifl.git +http://testbdgit2.educoder.net/educoder/an2ofy6k.git +http://testbdgit2.educoder.net/educoder/kao2rlf5.git +http://testbdgit2.educoder.net/educoder/uihap3wr.git +http://testbdgit2.educoder.net/educoder/wliam3nq.git +http://testbdgit2.educoder.net/educoder/7cpo6hel.git +http://testbdgit2.educoder.net/educoder/bmtlph7e.git +http://testbdgit2.educoder.net/educoder/b8n9twpf.git +http://testbdgit2.educoder.net/educoder/3cur5wz6.git +http://testbdgit2.educoder.net/educoder/h6ga29wv.git +http://testbdgit2.educoder.net/educoder/67kv4zmg.git +http://testbdgit2.educoder.net/educoder/buf6h8jf.git +http://testbdgit2.educoder.net/educoder/gce9ojqv.git +http://testbdgit2.educoder.net/educoder/jm2l6rwf.git +http://testbdgit2.educoder.net/educoder/4lwfjfrt.git +http://testbdgit2.educoder.net/educoder/5qsw32oj.git +http://testbdgit2.educoder.net/educoder/9yw36vxq.git +http://testbdgit2.educoder.net/educoder/93fivo6k.git +http://testbdgit2.educoder.net/educoder/nwy3x4t2.git +http://testbdgit2.educoder.net/educoder/ku9o2fcf.git +http://testbdgit2.educoder.net/educoder/s68uqlic.git +http://testbdgit2.educoder.net/educoder/4bajyohg.git +http://testbdgit2.educoder.net/educoder/qtfpscz8.git +http://testbdgit2.educoder.net/educoder/j5u7y6wn.git +http://testbdgit2.educoder.net/educoder/btku8vcx.git +http://testbdgit2.educoder.net/educoder/a9n8w2eu.git +http://testbdgit2.educoder.net/educoder/vze7ny25.git +http://testbdgit2.educoder.net/educoder/yz5aofe2.git +http://testbdgit2.educoder.net/educoder/r9nibvz4.git +http://testbdgit2.educoder.net/educoder/6cvxk3q8.git +http://testbdgit2.educoder.net/educoder/rmtuvk6z.git +http://testbdgit2.educoder.net/educoder/sbitr936.git +http://testbdgit2.educoder.net/educoder/sb6j4raf.git +http://testbdgit2.educoder.net/educoder/a7gfvh5s.git +http://testbdgit2.educoder.net/educoder/zsj6ao3c.git +http://testbdgit2.educoder.net/educoder/8x2epwk6.git +http://testbdgit2.educoder.net/educoder/cbnfxeiw.git +http://testbdgit2.educoder.net/educoder/ul47bqcn.git +http://testbdgit2.educoder.net/educoder/ltsnfy4x.git +http://testbdgit2.educoder.net/educoder/t53nvo8e.git +http://testbdgit2.educoder.net/educoder/yojwp2mb.git +http://testbdgit2.educoder.net/educoder/67nayvtg.git +http://testbdgit2.educoder.net/educoder/42fq3yx7.git +http://testbdgit2.educoder.net/educoder/f39hiscw.git +http://testbdgit2.educoder.net/educoder/jey9avks.git +http://testbdgit2.educoder.net/educoder/ascbpy86.git +http://testbdgit2.educoder.net/educoder/vagzfryl.git +http://testbdgit2.educoder.net/educoder/c6k5i82o.git +http://testbdgit2.educoder.net/educoder/utr8bp9a.git +http://testbdgit2.educoder.net/educoder/ul65ap4o.git +http://testbdgit2.educoder.net/educoder/bmulap4n.git +http://testbdgit2.educoder.net/educoder/nxj2sfvr.git +http://testbdgit2.educoder.net/educoder/vq5t9hea.git +http://testbdgit2.educoder.net/educoder/7g5l6kzr.git +http://testbdgit2.educoder.net/educoder/2y8t594n.git +http://testbdgit2.educoder.net/educoder/mlnpqx9r.git +http://testbdgit2.educoder.net/educoder/apgxmqs7.git +http://testbdgit2.educoder.net/educoder/vur567ha.git +http://testbdgit2.educoder.net/educoder/qwctfpjl.git +http://testbdgit2.educoder.net/educoder/5w6gh9m8.git +http://testbdgit2.educoder.net/educoder/fzhe4mpv.git +http://testbdgit2.educoder.net/educoder/vmygstfb.git +http://testbdgit2.educoder.net/educoder/uryh3e4i.git +http://testbdgit2.educoder.net/educoder/nbixuzkf.git +http://testbdgit2.educoder.net/educoder/zpkyj7bs.git +http://testbdgit2.educoder.net/educoder/79tpk5oy.git +http://testbdgit2.educoder.net/educoder/s93x58at.git +http://testbdgit2.educoder.net/educoder/6ymec92a.git +http://testbdgit2.educoder.net/educoder/7vqgbsfc.git +http://testbdgit2.educoder.net/educoder/fr5fom8n.git +http://testbdgit2.educoder.net/educoder/7uzyskn9.git +http://testbdgit2.educoder.net/educoder/g4fvywf6.git +http://testbdgit2.educoder.net/educoder/wa98h2ly.git +http://testbdgit2.educoder.net/educoder/u6i2o3qz.git +http://testbdgit2.educoder.net/educoder/enxbyiok.git +http://testbdgit2.educoder.net/educoder/2fuweqf8.git +http://testbdgit2.educoder.net/educoder/48flws5g.git +http://testbdgit2.educoder.net/educoder/yugrij4n.git +http://testbdgit2.educoder.net/educoder/gtbkvm58.git +http://testbdgit2.educoder.net/educoder/nes73wfv.git +http://testbdgit2.educoder.net/educoder/oztyjl4h.git +http://testbdgit2.educoder.net/educoder/f398leqr.git +http://testbdgit2.educoder.net/educoder/i3xutoze.git +http://testbdgit2.educoder.net/educoder/mfv6zrj7.git +http://testbdgit2.educoder.net/educoder/6ujfeqbh.git +http://testbdgit2.educoder.net/educoder/8x93tfqn.git +http://testbdgit2.educoder.net/educoder/fxv9bpcw.git +http://testbdgit2.educoder.net/eduforge/64xb9k2q.git +http://testbdgit2.educoder.net/educoder/5e4vcr7t.git +http://testbdgit2.educoder.net/educoder/qwaffs2p.git +http://testbdgit2.educoder.net/educoder/ose7482b.git +http://testbdgit2.educoder.net/educoder/wt2xfzny.git +http://testbdgit2.educoder.net/educoder/cuqnpzjv.git +http://testbdgit2.educoder.net/educoder/n3a8q9b2.git +http://testbdgit2.educoder.net/educoder/f9o4hpix.git +http://testbdgit2.educoder.net/educoder/bm9qr7ue.git +http://testbdgit2.educoder.net/educoder/nhlygi7p.git +http://testbdgit2.educoder.net/educoder/mf2vfngu.git +http://testbdgit2.educoder.net/educoder/x6tsevzy.git +http://testbdgit2.educoder.net/educoder/rjfbm74o.git +http://testbdgit2.educoder.net/educoder/ztbukf7e.git +http://testbdgit2.educoder.net/educoder/pf8yze9h.git +http://testbdgit2.educoder.net/educoder/nrug2mfz.git +http://testbdgit2.educoder.net/educoder/jswmzaxr.git +http://testbdgit2.educoder.net/educoder/wpxjzo3c.git +http://testbdgit2.educoder.net/educoder/zaohblre.git +http://testbdgit2.educoder.net/educoder/psx2h9kf.git +http://testbdgit2.educoder.net/educoder/ayju6fie.git +http://testbdgit2.educoder.net/educoder/5kp9guol.git +http://testbdgit2.educoder.net/educoder/c4ztkfb2.git +http://testbdgit2.educoder.net/educoder/kboupjtl.git +http://testbdgit2.educoder.net/educoder/bcvhs9u7.git +http://testbdgit2.educoder.net/educoder/26vljnb3.git +http://testbdgit2.educoder.net/educoder/zesqa3wi.git +http://testbdgit2.educoder.net/educoder/43phxgsf.git +http://testbdgit2.educoder.net/educoder/fbx6awcm.git +http://testbdgit2.educoder.net/educoder/i2s7jof5.git +http://testbdgit2.educoder.net/educoder/n2w4jrax.git +http://testbdgit2.educoder.net/educoder/4pou5tey.git +http://testbdgit2.educoder.net/eduforge/e9qr7cxi.git +http://testbdgit2.educoder.net/educoder/y6bg739q.git +http://testbdgit2.educoder.net/educoder/h32r58s7.git +http://testbdgit2.educoder.net/eduforge/hpr7ojgc-1.git +http://testbdgit2.educoder.net/educoder/c3j4hufp.git +http://testbdgit2.educoder.net/eduforge/o72clmi4.git +http://testbdgit2.educoder.net/educoder/qfz8o2r6.git +http://testbdgit2.educoder.net/educoder/rw3i8vf2.git +http://testbdgit2.educoder.net/educoder/shpwf3xf.git +http://testbdgit2.educoder.net/eduforge/vnw2fg5r.git +http://testbdgit2.educoder.net/innov/f2izon59.git +http://testbdgit2.educoder.net/innov/qlkpiusm.git +http://testbdgit2.educoder.net/innov/edu1547017399.git +http://testbdgit2.educoder.net/forge01/cermyt39.git +http://testbdgit2.educoder.net/innov/em3z8yn6.git +http://testbdgit2.educoder.net/innov/c8ynf526.git +http://testbdgit2.educoder.net/Hjqreturn/sx36oveq.git +http://testbdgit2.educoder.net/innov/t7sxkfab20190115135957.git +http://testbdgit2.educoder.net/innov/etlb3pn620190115140004.git +http://testbdgit2.educoder.net/innov/5jbomfrg20190115140011.git +http://testbdgit2.educoder.net/innov/6ecmbf7g20190115140015.git +http://testbdgit2.educoder.net/innov/f7jn8kex20190115140330.git diff --git a/lib/gitcheck/shixun_update_error.txt b/lib/gitcheck/shixun_update_error.txt new file mode 100644 index 000000000..ef9663c46 --- /dev/null +++ b/lib/gitcheck/shixun_update_error.txt @@ -0,0 +1,72 @@ +mbtclufr +9op3hs4j +96ctv7yr +rtmzxfke +ofqxthrf +czu9w4gj +9fpzj6et +pwhc865b +maozpx4l +y5wh2ofx +b5rzhpf3 +bs243nrl +47fn2yfb +kwotfxey +w5468sbp +fyekprio +q6ze5fih +b5hjq9zm +ky8pbqux +53phc7nq +b9j2yuix +9t3uphwk +iokm8ah2 +qlsy6xb4 +345bqhfi +v728fqia +4euftvf2 +f23sef5m +nhqis8m9 +qp72tb5x +gt3anszw +tng6heyf +nb9keawo +elgnbkp9 +4neslomg +lh35s6ma +xmc4rpay +qrpaxi6b +9fla2zry +efuibzrm +fzp3iu4w +pligsyn8 +glbksr29 +kfm7ghyc +p6hk3svf +p539gjhm +am5o73er +4x3qwrbe +fqosyl8g +of5z3fci +tb7hw62n +ie6zxg7r +4q2bmy9h +fpm3u5yb +nikx3ojt +vt82s9bq +ma59fefo +lxa39tfq +4gnockxf +nxwg84ey +fmie8nzb +w5nsr24v +4hn3efwc +h9ljfbq7 +nuv54t8b +2te9fmfq +vihnsayz +qhlyn82s +vw74kmfr +vcta36bz +henz425l +g529v38z diff --git a/lib/tasks/git_check.rake b/lib/tasks/git_check.rake index 64f8be91b..a5e95eedc 100644 --- a/lib/tasks/git_check.rake +++ b/lib/tasks/git_check.rake @@ -1,15 +1,52 @@ +# 需要做的几件事: +# 1、检测两边(TPM\TPI)同步后有更新的仓库 +# + namespace :git do desc "检测是否TPM是否需要更新" task :shixun_check_update => :environment do - + g = Gitlab.client + file_txt = File.new("lib/gitcheck/shixun_update.txt", "r+") + file_error_txt = File.new("lib/gitcheck/shixun_update_error.txt", "r+") + host = EduSetting.find_by_name("git_address_domain").try(:value) + Shixun.find_each do |shixun| + begin + gitlab_commit = g.commits(shixun.gpid, :ref_name => 'master').first.try(:id) + repo_name = shixun.repo_name + git_commit = GitService.commits(repo_path: "#{repo_name}.git").first["id"] + git_url = host + "/" + repo_name + ".git\n" + if git_commit != gitlab_commit + file_txt.syswrite(git_url) + end + rescue + file_error_txt.syswrite("#{shixun.identifier}\n") + end + end end - desc "检测版本库是否有异常" + desc "检测版本库是否有更新" task :myshixuns_check_update => :environment do - + g = Gitlab.client + file_txt = File.new("lib/gitcheck/myshixun_update.txt", "r+") + file_error_txt = File.new("lib/gitcheck/myshixun_update_error.txt", "r+") + host = EduSetting.find_by_name("git_address_domain").try(:value) + Myshixun.find_each do |myshixun| + begin + gitlab_commit = g.commits(myshixun.gpid, :ref_name => 'master').first.try(:id) + repo_name = myshixun.repo_name + git_commit = GitService.commits(repo_path: "#{repo_name}.git").first["id"] + git_url = host + "/" + repo_name + ".git\n" + if git_commit != gitlab_commit + file_txt.syswrite(git_url) + end + rescue + file_error_txt.syswrite("#{myshixun.identifier}\n") + end + end end + # 检测TPI没有迁移过来的 task :check => :environment do end diff --git a/lib/tasks/graduation_task.rake b/lib/tasks/graduation_task.rake index aad84491f..58f7764d0 100644 --- a/lib/tasks/graduation_task.rake +++ b/lib/tasks/graduation_task.rake @@ -5,27 +5,9 @@ namespace :graduation_task do tasks = GraduationTask.where("publish_time is not null and publish_time <= '#{Time.now}' and status = 0") tasks.each do |task| task.update_attributes(status: 1) - course = task.course - members = course.course_members - if !course.nil? && !members.empty? - tid_str = "" - members.find_each do |member| - tid_str += "," if tid_str != "" - tid_str += "(#{member.user_id}, #{task.user_id}, #{task.id}, 'GraduationTask', #{task.id}, 'TaskPublish', - #{course.id}, 'Course', 0, 'GraduationTask', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', - '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')" - end - if tid_str != "" - tid_sql = "insert into tidings (user_id, trigger_user_id, container_id, container_type, parent_container_id, - parent_container_type, belong_container_id, belong_container_type, viewed, tiding_type, created_at, - updated_at) values" + tid_str - ActiveRecord::Base.connection.execute tid_sql - end - end + GraduationTaskPublishNotifyJob.perform_later(task.id) - if task.course_acts.size == 0 - task.course_acts << CourseActivity.new(user_id: task.user_id, course_id: task.course_id) - end + task.course_acts << CourseActivity.new(user_id: task.user_id, course_id: task.course_id) if !task.course_acts.exists? end end @@ -62,37 +44,11 @@ namespace :graduation_task do tasks = GraduationTask.where("cross_comment = 1 and comment_time is not null and comment_time <= '#{Time.now}' and status = 2") tasks.each do |task| if task.comment_status == 4 - course = task.course - task.graduation_task_group_assignations.each do |assignation| - graduation_group = assignation.graduation_group - assign_group = assignation.assign_group - if graduation_group.present? && assign_group.present? - course_group_ids = course.teacher_course_groups.where(course_member_id: graduation_group.course_members.pluck(:id)).pluck(:course_group_id) - graduation_works = task.graduation_works.where(user_id: course.course_members.where(:course_group_id => course_group_ids).map(&:user_id), - work_status: [1, 2]) - if assign_group.course_members.count <= task.comment_num - graduation_works.each do |work| - assign_group.course_members.each do |member| - work.graduation_work_comment_assignations << GraduationWorkCommentAssignation.new( - graduation_group_id: assign_group.id, user_id: member.user_id, graduation_task_id: task.id) - end - end - else - member_user_ids = assign_group.course_members.pluck(:user_id) - count = 0 - graduation_works.each do |work| - for i in 1 .. task.comment_num - assign_user_id = member_user_ids[count % member_user_ids.size] - work.graduation_work_comment_assignations << GraduationWorkCommentAssignation.new( - graduation_group_id: assign_group.id, user_id: assign_user_id, graduation_task_id: task.id) - count += 1 - end - end - end - end - end + GraduationTaskCrossCommentJob.perform_later(task.id) end task.update_attributes(status: 3) + + # 给老师发消息 tid_str = "" task.course.teachers.find_each do |member| tid_str += "," if tid_str != "" diff --git a/lib/tasks/homework_evaluation.rake b/lib/tasks/homework_evaluation.rake index cb7b51fae..56c46179c 100644 --- a/lib/tasks/homework_evaluation.rake +++ b/lib/tasks/homework_evaluation.rake @@ -23,59 +23,11 @@ namespace :homework_evaluation do else student_works = homework_common.student_works.has_committed end - if student_works.present? && student_works.length >= 2 - if homework_common.homework_type == "group" - student_work_projects = homework_common.student_works.where("work_status != 0").shuffle - student_work_projects.each_with_index do |pro_work, pro_index| - n = homework_detail_manual.evaluation_num - n = (n < student_works.size && n != -1) ? n : student_works.size - 1 - work_index = -1 - student_works.each_with_index do |stu_work, stu_index| - if stu_work.group_id.to_i == pro_work.group_id.to_i - work_index = stu_index - end - end - assigned_homeworks = get_assigned_homeworks(student_works, n, work_index) - assigned_homeworks.each do |h| - student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id) - student_works_evaluation_distributions.save - end - #更新CourseHomeworkStatistics中该学生的待匿评数 - # course_statistics = CourseHomeworkStatistics.find_by_course_id_and_user_id(homework_common.course_id, pro_work.user_id) - # course_statistics.update_attribute('un_evaluation_work_num', course_statistics.un_evaluation_work_num + n) if course_statistics - end - else - student_works = student_works.shuffle - student_works.each_with_index do |work, index| - user = work.user - n = homework_detail_manual.evaluation_num - n = (n < student_works.size && n != -1) ? n : student_works.size - 1 - assigned_homeworks = get_assigned_homeworks(student_works, n, index) - assigned_homeworks.each do |h| - student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id) - student_works_evaluation_distributions.save - end + if student_works.present? && student_works.length >= 2 + HomeworkEvaluationCommentAssginJob.perform_later(homework_common.id) - #更新CourseHomeworkStatistics中该学生的待匿评数 - # course_statistics = CourseHomeworkStatistics.find_by_course_id_and_user_id(homework_common.course_id, user.id) - # course_statistics.update_attribute('un_evaluation_work_num', course_statistics.un_evaluation_work_num + n) if course_statistics - end - end homework_detail_manual.update_column('comment_status', 3) - # 匿评开启消息邮件通知,# 所有人 - str = "" - homework_common.course.course_members.pluck(:user_id).uniq.each do |user_id| - str += "," if str != "" - str += "('#{user_id}', '#{homework_common.user_id}', '#{homework_common.id}','HomeworkCommon','#{homework_common.id}', - 'AnonymousComment',#{homework_common.course_id},'Course',0,'HomeworkCommon', - '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')" - end - if str != "" - sql = "insert into tidings (user_id,trigger_user_id,container_id, container_type, parent_container_id, - parent_container_type, belong_container_id, belong_container_type, viewed, tiding_type, created_at, updated_at) values" + str - ActiveRecord::Base.connection.execute sql - end else #作业数小于2,启动失败, 只给老师和助教发 extra = "作品数量低于两个,无法开启匿评" @@ -83,20 +35,8 @@ namespace :homework_evaluation do else extra = "存在尚未截止的分班,无法开启匿评" end + HomeworkEvaluationStartNotifyJob.perform_later(homework_common.id, extra) if extra.present? - str = '' - homework_common.course.teachers.each do |mem| - str += "," if str != "" - str += "('#{mem.user.id}', '#{homework_common.user_id}', '#{homework_common.id}','HomeworkCommon','#{homework_common.id}', - 'AnonymousCommentFail',#{homework_common.course_id},'Course',0,'System','#{extra}', - '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')" - end - if str != "" - sql = "insert into tidings (user_id,trigger_user_id,container_id, container_type,parent_container_id, - parent_container_type, belong_container_id, belong_container_type, viewed, tiding_type, extra, created_at, - updated_at) values" + str - ActiveRecord::Base.connection.execute sql - end homework_detail_manual.update_attributes(:evaluation_start => nil, :evaluation_end => nil, :absence_penalty => 0, :evaluation_num => 0, :appeal_time => nil, :appeal_penalty => 0) homework_common.update_attributes(:anonymous_comment => 0, :anonymous_appeal => 0) @@ -114,63 +54,15 @@ namespace :homework_evaluation do homework_detail_manuals.each do |homework_detail_manual| homework_common = homework_detail_manual.homework_common if homework_common.anonymous_comment #开启匿评状态才可关闭匿评 - #计算缺评扣分 参与匿评 - work_ids = "(" + homework_common.student_works.has_committed.map(&:id).join(",") + ")" - - homework_common.student_works.where("work_status != 0").each do |student_work| - absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - - student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and reviewer_role = 3").count - - student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0 - student_work.save - - #更新CourseHomeworkStatistics中该学生的待匿评数和缺评数 - # absence_penalty_count = absence_penalty_count > 0 ? absence_penalty_count : 0 - # course_statistics = CourseHomeworkStatistics.find_by_course_id_and_user_id(homework_common.course_id, student_work.user_id) - # course_statistics.update_attribute('un_evaluation_work_num', (course_statistics.un_evaluation_work_num - absence_penalty_count) < 0 ? 0 : - # (course_statistics.un_evaluation_work_num - absence_penalty_count)) if course_statistics - # course_statistics.update_attribute('absence_evaluation_work_num', course_statistics.absence_evaluation_work_num + absence_penalty_count) if course_statistics - end - - # 未参与匿评 - if homework_common.homework_detail_manual.no_anon_penalty == 0 - all_dis_eva = StudentWorksEvaluationDistribution.where("student_work_id IN #{work_ids}") - has_sw_count = all_dis_eva.select("distinct user_id").count - anon_count = all_dis_eva.count / has_sw_count - homework_common.student_works.where("work_status != 0").each do |student_work| - if student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count == 0 - student_work.absence_penalty = homework_detail_manual.absence_penalty * anon_count - student_work.save - end - end - end - if homework_common.anonymous_appeal homework_detail_manual.update_column('comment_status', 4) - # 申诉开启 - eva_distribution = StudentWorksEvaluationDistribution.where(:student_work_id => homework_common.student_works.pluck(:id)) - str = "" - eva_distribution.pluck(:user_id).uniq.each do |user_id| - str += "," if str != "" - str += "(#{user_id}, #{homework_common.user_id}, #{homework_common.id}, 'HomeworkCommon', #{homework_common.id}, - 'AnonymousAppeal', #{homework_common.course_id}, 'Course', 0, 'HomeworkCommon', - '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')" - end - if str != "" - sql = "insert into tidings (user_id,trigger_user_id,container_id, container_type, parent_container_id, - parent_container_type, belong_container_id, belong_container_type, viewed, tiding_type, created_at, updated_at) values" + str - ActiveRecord::Base.connection.execute sql - end + # 申诉开启发送消息 + HomeworkAnonymousAppealStartNotifyJob.perform_later(homework_common.id) else homework_detail_manual.update_column('comment_status', 5) end - # 匿评关闭消息通知 给所有人发 - # course = homework_common.course - # course.members.each do |m| - # homework_common.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 3) - # end - # 邮件通知 - # Mailer.send_mail_anonymous_comment_close(homework_common).deliver + + HomeworkAbsencePenaltyCalculationJob.perform_later(homework_common.id) end end end diff --git a/lib/tasks/homework_publishtime.rake b/lib/tasks/homework_publishtime.rake index 0e45b0224..7ee2a4a07 100644 --- a/lib/tasks/homework_publishtime.rake +++ b/lib/tasks/homework_publishtime.rake @@ -21,37 +21,31 @@ namespace :homework_publishtime do homework_commons.each do |homework| homework_detail_manual = homework.homework_detail_manual homework_detail_manual.update_column('comment_status', 1) - course = homework.course - students = course.students - if !course.nil? && !students.empty? + # 统一设置的作业在这发消息,非统一设置的只给有全部分班权限的老师发 + if homework.unified_setting + HomeworkPublishUpdateWorkStatusJob.perform_later(nil, homework.id) + HomeworkCommonPushNotifyJob.perform_later(homework.id, nil) + else + course = homework.course + teachers = course.teachers.where.not(id: course.teacher_course_groups.select(:course_member_id)) + tid_str = "" - course.teachers.find_each do |member| + teachers.find_each do |member| tid_str += "," if tid_str != "" tid_str += "(#{member.user_id}, #{homework.user_id}, #{homework.id}, 'HomeworkCommon', #{homework.id}, 'HomeworkPublish', #{course.id}, 'Course', 0, 'HomeworkCommon', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')" end - if homework.unified_setting - students.each do |student| - tid_str += "," if tid_str != "" - tid_str += "(#{student.user_id}, #{homework.user_id}, #{homework.id}, 'HomeworkCommon', #{homework.id}, - 'HomeworkPublish', #{course.id}, 'Course', 0, 'HomeworkCommon', - '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')" - end - HomeworkPublishUpdateWorkStatusJob.perform_now(nil, homework.id) - end if tid_str != "" tid_sql = "insert into tidings (user_id, trigger_user_id, container_id, container_type, parent_container_id, parent_container_type, belong_container_id, belong_container_type, viewed, tiding_type, created_at, updated_at) values" + tid_str ActiveRecord::Base.connection.execute tid_sql end - end - - if homework.course_acts.size == 0 - homework.course_acts << CourseActivity.new(:user_id => homework.user_id,:course_id => homework.course_id) end + + homework.course_acts << CourseActivity.new(user_id: homework.user_id, course_id: homework.course_id) if !homework.course_acts.exists? end # 分组设置发布时间的作业 @@ -59,27 +53,8 @@ namespace :homework_publishtime do homework_group_settings.each do |homework_group| homework = homework_group.homework_common if homework.present? - course = homework.course - homework_detail_manual = homework.homework_detail_manual - homework_detail_manual.update_column('comment_status', 1) if homework_detail_manual.comment_status == 0 - - tid_str = "" - members = course.students.where(:course_group_id => homework_group.course_group_id) - members.find_each do |member| - tid_str += "," if tid_str != "" - tid_str += "(#{member.user_id}, #{homework.user_id}, #{homework.id}, 'HomeworkCommon', #{homework.id}, 'HomeworkPublish', - #{course.id}, 'Course', 0, 'HomeworkCommon', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', - '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')" - end - if tid_str != "" - tid_sql = "insert into tidings (user_id, trigger_user_id, container_id, container_type, parent_container_id, - parent_container_type, belong_container_id, belong_container_type, viewed, tiding_type, created_at, - updated_at) values" + tid_str - ActiveRecord::Base.connection.execute tid_sql - end - HomeworkPublishUpdateWorkStatusJob.perform_now([homework_group.id], homework.id) - + HomeworkCommonPushNotifyJob.perform_later(homework.id, [homework_group.course_group_id]) end end Rails.logger.info("log--------------------------------homework_publish end") @@ -98,11 +73,10 @@ namespace :homework_publishtime do student_works = homework.student_works.where("work_status != 0") # none_student_works = homework.student_works.where("work_status = 0") else - setting = homework.homework_group_settings.where(:end_time => homework.end_time) + setting = homework.homework_group_settings.where(end_time: homework.end_time) unless setting.blank? - users = homework.course.students.where(:course_group_id => setting.map(&:course_group_id)) - user_ids = users.blank? ? "(-1)" : "(" + users.map(&:user_id).join(",") + ")" - student_works = homework.student_works.where("work_status != 0 and user_id in #{user_ids}") + users = homework.course.students.where(course_group_id: setting.pluck(:course_group_id)) + student_works = homework.student_works.where("work_status != 0").where(user_id: users.pluck(:user_id)) # none_student_works = homework.student_works.where("work_status = 0 and user_id in #{user_ids}") end end @@ -172,8 +146,7 @@ namespace :homework_publishtime do # homework_challenge_settings = homework.homework_challenge_settings users = homework.course.students.where(:course_group_id => homework_setting.course_group_id) - user_ids = users.blank? ? "(-1)" : "(" + users.map(&:user_id).join(",") + ")" - student_works = homework.student_works.where("work_status != 0 and user_id in #{user_ids}") + student_works = homework.student_works.where("work_status != 0").where(user_id: users.pluck(:user_id)) student_works.joins(:myshixun).where("myshixuns.status != 1").update_all(late_penalty: homework.late_penalty) if student_works.present? else # HomeworksService.new.update_student_eff_score homework # 分班设置的不需要另外算效率分 diff --git a/lib/tasks/poll_publish.rake b/lib/tasks/poll_publish.rake index 6ced88908..8cec43565 100644 --- a/lib/tasks/poll_publish.rake +++ b/lib/tasks/poll_publish.rake @@ -9,39 +9,22 @@ namespace :poll_publish do polls = Poll.includes(:poll_users).where("publish_time is not null and polls_status = 1 and publish_time <=?",Time.now) polls.each do |poll| poll.update_attributes(:polls_status => 2) - course = poll.course - tid_str = "" - course.teachers.find_each do |member| - tid_str += "," if tid_str != "" - tid_str += "(#{member.user_id}, #{poll.user_id}, #{poll.id}, 'Poll', #{poll.id}, 'PollPublish', #{course.id}, 'Course', 0, 'Poll', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')" - end if poll.unified_setting - course.students.find_each do |student| + PollPublishNotifyJob.perform_later(poll.id, nil) + else + course = poll.course + teachers = course.teachers.where.not(id: course.teacher_course_groups.select(:course_member_id)) + tid_str = "" + teachers.find_each do |member| tid_str += "," if tid_str != "" - tid_str += "(#{student.user_id}, #{poll.user_id}, #{poll.id}, 'Poll', #{poll.id}, 'PollPublish', #{course.id}, 'Course', 0, 'Poll', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')" - end - end - if tid_str != "" - tid_sql = "insert into tidings (user_id, trigger_user_id, container_id, container_type, parent_container_id, parent_container_type, belong_container_id, belong_container_type, viewed, tiding_type, created_at, updated_at) values" + tid_str - ActiveRecord::Base.connection.execute tid_sql - end - - if poll.poll_users.count == 0 - str = "" - course.students.find_each do |student| - str += "," if str != "" - str += "(#{student.user_id},#{poll.id}, 0, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')" + tid_str += "(#{member.user_id}, #{poll.user_id}, #{poll.id}, 'Poll', #{poll.id}, 'PollPublish', #{course.id}, 'Course', 0, 'Poll', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')" end - - if str != "" - sql = "insert into poll_users (user_id, poll_id, commit_status, created_at, updated_at) values" + str - ActiveRecord::Base.connection.execute sql + if tid_str != "" + tid_sql = "insert into tidings (user_id, trigger_user_id, container_id, container_type, parent_container_id, parent_container_type, belong_container_id, belong_container_type, viewed, tiding_type, created_at, updated_at) values" + tid_str + ActiveRecord::Base.connection.execute tid_sql end end - - if poll.course_acts.size == 0 - poll.course_acts << CourseActivity.new(:user_id => poll.user_id,:course_id => poll.course_id) - end + poll.course_acts << CourseActivity.new(user_id: poll.user_id, course_id: poll.course_id) if !poll.course_acts.exists? end # 分组设置发布时间的问卷 @@ -49,19 +32,8 @@ namespace :poll_publish do poll_group_settings.each do |poll_group| poll = poll_group.poll if poll.present? - course = poll.course poll.update_attributes(:polls_status => 2) if poll.polls_status == 1 - - tid_str = "" - members = course.course_members.where(:course_group_id => poll_group.course_group_id) - members.find_each do |member| - tid_str += "," if tid_str != "" - tid_str += "(#{member.user_id},#{poll.user_id}, #{poll.id}, 'Poll', #{poll.id}, 'PollPublish', #{course.id}, 'Course', 0, 'Poll', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')" - end - if tid_str != "" - tid_sql = "insert into tidings (user_id, trigger_user_id, container_id, container_type, parent_container_id, parent_container_type, belong_container_id, belong_container_type, viewed, tiding_type, created_at, updated_at) values" + tid_str - ActiveRecord::Base.connection.execute tid_sql - end + PollPublishNotifyJob.perform_later(poll.id, [poll_group.course_group_id]) end end diff --git a/spec/jobs/graduation_task_cross_comment_job_spec.rb b/spec/jobs/graduation_task_cross_comment_job_spec.rb new file mode 100644 index 000000000..d517d939b --- /dev/null +++ b/spec/jobs/graduation_task_cross_comment_job_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe GraduationTaskCrossCommentJob, type: :job do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/jobs/graduation_task_publish_notify_job_spec.rb b/spec/jobs/graduation_task_publish_notify_job_spec.rb new file mode 100644 index 000000000..39f6046af --- /dev/null +++ b/spec/jobs/graduation_task_publish_notify_job_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe GraduationTaskPublishNotifyJob, type: :job do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/jobs/homework_absence_penalty_calculation_job_spec.rb b/spec/jobs/homework_absence_penalty_calculation_job_spec.rb new file mode 100644 index 000000000..b347086ce --- /dev/null +++ b/spec/jobs/homework_absence_penalty_calculation_job_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe HomeworkAbsencePenaltyCalculationJob, type: :job do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/jobs/homework_anonymous_appeal_start_notify_job_spec.rb b/spec/jobs/homework_anonymous_appeal_start_notify_job_spec.rb new file mode 100644 index 000000000..bd5db1e69 --- /dev/null +++ b/spec/jobs/homework_anonymous_appeal_start_notify_job_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe HomeworkAnonymousAppealStartNotifyJob, type: :job do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/jobs/homework_evaluation_comment_assgin_job_spec.rb b/spec/jobs/homework_evaluation_comment_assgin_job_spec.rb new file mode 100644 index 000000000..7a31a825f --- /dev/null +++ b/spec/jobs/homework_evaluation_comment_assgin_job_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe HomeworkEvaluationCommentAssginJob, type: :job do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/jobs/homework_evaluation_start_notify_job_spec.rb b/spec/jobs/homework_evaluation_start_notify_job_spec.rb new file mode 100644 index 000000000..b347ea1f5 --- /dev/null +++ b/spec/jobs/homework_evaluation_start_notify_job_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe HomeworkEvaluationStartNotifyJob, type: :job do + pending "add some examples to (or delete) #{__FILE__}" +end