Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/educoder into develop
commit
c61c2f5331
@ -0,0 +1,21 @@
|
||||
class CreateStudentWorkJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
def perform(homework_id)
|
||||
homework = HomeworkCommon.find_by(id: homework_id)
|
||||
course = homework&.course
|
||||
return if homework.blank? || course.blank?
|
||||
|
||||
attrs = %i[homework_common_id user_id created_at updated_at]
|
||||
|
||||
same_attrs = {homework_common_id: homework.id}
|
||||
|
||||
StudentWork.bulk_insert(*attrs) do |worker|
|
||||
student_ids = course.students.pluck(:user_id)
|
||||
|
||||
student_ids.each do |user_id|
|
||||
worker.add same_attrs.merge(user_id: user_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,2 @@
|
||||
class OldMessageDetail < ApplicationRecord
|
||||
end
|
@ -1,19 +1,39 @@
|
||||
class AddExerciseUserUpdate < ActiveRecord::Migration[5.2]
|
||||
include ExercisesHelper
|
||||
def change
|
||||
# exs = Exercise.all.is_exercise_published.where("publish_time > ?",(Time.now - 2.months)).includes(:exercise_questions,:exercise_users)
|
||||
# exs.each do |ex|
|
||||
# ex_users = ex.exercise_users.exercise_user_committed.where("end_at is not null and end_at > ?",(Time.now - 2.months))
|
||||
# if ex_users.present?
|
||||
# ex_users.each do |ex_user|
|
||||
# calculate_score = calculate_student_score(ex,ex_user.user)[:total_score]
|
||||
# subjective_score = ex_user.subjective_score
|
||||
# total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score
|
||||
# total_score = calculate_score + total_score_subjective_score
|
||||
# ex_user.update_attributes(score:total_score,objective_score:calculate_score)
|
||||
# puts ex_user.id
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
# include ExercisesHelper
|
||||
# def change
|
||||
# #2019,8,22添加
|
||||
# two_months = Time.now - 2.months
|
||||
# exs = Exercise.all.is_exercise_published.where("publish_time > ?",two_months).includes(:exercise_questions,:exercise_users)
|
||||
# exs.each do |ex|
|
||||
# if ex.exercise_questions.where("created_at < ?",Time.now - 1.month).pluck(:question_type).include?(1) #含有多选题,且是1个月前创建的才更新
|
||||
# ex_users = ex.exercise_users.exercise_user_committed.where("end_at is not null and end_at > ?",two_months)
|
||||
# if ex_users.exists?
|
||||
# ex_users.each do |ex_user|
|
||||
# calculate_score = calculate_student_score(ex,ex_user.user)[:total_score]
|
||||
# subjective_score = ex_user.subjective_score
|
||||
# total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score
|
||||
# total_score = calculate_score + total_score_subjective_score
|
||||
# ex_user.update_attributes(score:total_score,objective_score:calculate_score)
|
||||
# puts ex_user.id
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# #1936的试卷成绩有问题。
|
||||
# # #https://www.educoder.net/courses/2935/exercises/1936/users/pizfnr5ts
|
||||
# ex_special = Exercise.find_by_id(1936)
|
||||
# ex_special_users = ex_special.exercise_users.exercise_user_committed.where("end_at is not null and end_at > ?",two_months)
|
||||
# if ex_special.present? && ex_special_users.exists?
|
||||
# ex_special_users.each do |ex_user|
|
||||
# calculate_score = calculate_student_score(ex_special,ex_user.user)[:total_score]
|
||||
# subjective_score = ex_user.subjective_score
|
||||
# total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score
|
||||
# total_score = calculate_score + total_score_subjective_score
|
||||
# ex_user.update_attributes(score:total_score,objective_score:calculate_score)
|
||||
# puts ex_user.id
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
@ -0,0 +1,9 @@
|
||||
class AddMessageCountForBoards < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
boards = Board.where(:parent_id => 0)
|
||||
Board.reset_column_information
|
||||
boards.find_each do |board|
|
||||
Board.reset_counters board.id, :messages
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,19 @@
|
||||
class ChangeExericse1936Scores < ActiveRecord::Migration[5.2]
|
||||
include ExercisesHelper
|
||||
def change
|
||||
#1936的试卷成绩有问题。
|
||||
# #https://www.educoder.net/courses/2935/exercises/1936/users/pizfnr5ts
|
||||
ex_special = Exercise.find_by_id(1936)
|
||||
ex_special_users = ex_special&.exercise_users&.exercise_user_committed&.where("end_at is not null and end_at > ?",Time.now - 2.months)
|
||||
if ex_special.present? && ex_special_users.exists?
|
||||
ex_special_users.each do |ex_user|
|
||||
calculate_score = calculate_student_score(ex_special,ex_user.user)[:total_score]
|
||||
subjective_score = ex_user.subjective_score
|
||||
total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score
|
||||
total_score = calculate_score + total_score_subjective_score
|
||||
ex_user.update_attributes(score:total_score,objective_score:calculate_score)
|
||||
puts ex_user.id
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,13 @@
|
||||
class ModifyContentsForOldMessageDetails < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
messages = Message.where(subject: "新课导语").where.not(parent_id: 0).where("created_on < '2019-08-23 02:00:00'")
|
||||
messages.find_each do |m|
|
||||
m.update_column(:is_md, true)
|
||||
message_detail = m.message_detail
|
||||
if message_detail
|
||||
content = OldMessageDetail.find_by_id(message_detail.id)&.content
|
||||
message_detail.update_column(:content, content)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -1,72 +1,80 @@
|
||||
.studentList_operation_ul{
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
float: right;
|
||||
margin-top: 2px;
|
||||
}
|
||||
.studentList_operation_ul li{
|
||||
float: left;
|
||||
padding:0px 20px;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
flex: 0 0 26px;
|
||||
line-height: 26px;
|
||||
}
|
||||
.studentList_operation_ul li.li_line:after{
|
||||
position: absolute;
|
||||
content: '';
|
||||
width: 1px;
|
||||
height: 12px;
|
||||
background-color: #EDEDED;
|
||||
right: 0px;
|
||||
top:6px;
|
||||
}
|
||||
.studentList_operation_ul li:last-child{
|
||||
padding-right: 0px;
|
||||
}
|
||||
.studentList_operation_ul li:last-child:after{
|
||||
width: 0px;
|
||||
}
|
||||
|
||||
/* 基础的下拉列表、列如排序等 */
|
||||
.drop_down_normal li{
|
||||
padding: 0px 20px;
|
||||
height: 34px;
|
||||
line-height: 34px;
|
||||
min-width: 96px;
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.stu_table table{
|
||||
line-height: 1.2;
|
||||
}
|
||||
.stu_table .classesName{
|
||||
display: block;
|
||||
max-width: 428px;
|
||||
}
|
||||
.stu_table .ant-table-thead > tr > th{
|
||||
padding:21px 16px;
|
||||
border-bottom: none;
|
||||
}
|
||||
.stu_table .ant-table-tbody tr:last-child td{
|
||||
border-bottom: none;
|
||||
}
|
||||
.stu_table table .ant-table-tbody > tr:hover:not(.ant-table-expanded-row) > td{
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.stu_head{
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
.ant-modal-body{
|
||||
padding:30px 40px;
|
||||
}
|
||||
.color-dark-21{
|
||||
color: #212121;
|
||||
}
|
||||
.tabletd {
|
||||
background-color:#E6F7FF;
|
||||
}
|
||||
.studentList_operation_ul{
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
float: right;
|
||||
margin-top: 2px;
|
||||
}
|
||||
.studentList_operation_ul li{
|
||||
float: left;
|
||||
padding:0px 20px;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
flex: 0 0 26px;
|
||||
line-height: 26px;
|
||||
}
|
||||
.studentList_operation_ul li.li_line:after{
|
||||
position: absolute;
|
||||
content: '';
|
||||
width: 1px;
|
||||
height: 12px;
|
||||
background-color: #EDEDED;
|
||||
right: 0px;
|
||||
top:6px;
|
||||
}
|
||||
.studentList_operation_ul li:last-child{
|
||||
padding-right: 0px;
|
||||
}
|
||||
.studentList_operation_ul li:last-child:after{
|
||||
width: 0px;
|
||||
}
|
||||
|
||||
/* 基础的下拉列表、列如排序等 */
|
||||
.drop_down_normal li{
|
||||
padding: 0px 20px;
|
||||
height: 34px;
|
||||
line-height: 34px;
|
||||
min-width: 96px;
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.stu_table table{
|
||||
line-height: 1.2;
|
||||
}
|
||||
.stu_table .classesName{
|
||||
display: block;
|
||||
max-width: 428px;
|
||||
}
|
||||
.stu_table .ant-table-thead > tr > th{
|
||||
padding:21px 16px;
|
||||
border-bottom: none;
|
||||
}
|
||||
.stu_table .ant-table-tbody tr:last-child td{
|
||||
border-bottom: none;
|
||||
}
|
||||
.stu_table table .ant-table-tbody > tr:hover:not(.ant-table-expanded-row) > td{
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.stu_head{
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
.ant-modal-body{
|
||||
padding:30px 40px;
|
||||
}
|
||||
.color-dark-21{
|
||||
color: #212121;
|
||||
}
|
||||
.tabletd {
|
||||
background-color:#E6F7FF;
|
||||
}
|
||||
|
||||
.yslminheigth{
|
||||
min-height: 20px;
|
||||
}
|
||||
|
||||
.yslminheigths{
|
||||
min-height: 21px;
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe CreateStudentWorkJob, type: :job do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe OldMessageDetail, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
Loading…
Reference in new issue