Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_admin
hjm 6 years ago
commit 554e443b16

@ -38,7 +38,7 @@ class LibrariesController < ApplicationController
def create
library = current_user.libraries.new
Libraries::SaveService.call(library, current_user, save_params)
render_ok
render_ok({id: library})
rescue Libraries::SaveService::Error => ex
render_error(ex.message)
end
@ -47,7 +47,7 @@ class LibrariesController < ApplicationController
return render_forbidden unless library_manageable?(current_library)
Libraries::SaveService.call(current_library, current_user, save_params)
render_ok
render_ok({id: current_library.id})
rescue Libraries::SaveService::Error => ex
render_error(ex.message)
end

@ -782,8 +782,8 @@ class ShixunsController < ApplicationController
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 ? or users.phone like ?) AND LOWER(schools.name) LIKE
?", user_name, user_name, school_name)
(LOWER(concat(users.lastname, users.firstname)) LIKE ? or users.phone like ?)
AND LOWER(schools.name) LIKE ?", user_name, user_name, school_name)
else
@users = User.none
end

@ -360,7 +360,7 @@ class StudentWorksController < ApplicationController
Tiding.create(user_id: @work.user_id, trigger_user_id: User.current.id, container_id: new_score.id,
container_type: "StudentWorksScore", parent_container_id: @work.id,
parent_container_type: "HomeworkCommon", belong_container_id: @homework.course_id,
belong_container_type: "Course", viewed: 0, tiding_type: "HomeworkCommon", extra: new_score.reviewer_role)
belong_container_type: "Course", viewed: 0, tiding_type: new_score.reviewer_role == 3 ? "System" : "HomeworkCommon", extra: new_score.reviewer_role)
case new_score.reviewer_role
when 1 #教师评分:最后一个教师评分为最终评分

@ -19,11 +19,20 @@ class StudentWorkScoreAppealNotifyJob < ApplicationJob
belong_container_id: course.id, belong_container_type: 'Course',
tiding_type: 'HomeworkCommon', viewed: 0, status: 0
}
student_same_attrs = {
trigger_user_id: 0,
container_id: appeal.id, container_type: 'StudentWorksScoresAppeal',
parent_container_id: score.student_work_id, parent_container_type: 'StudentWork',
belong_container_id: course.id, belong_container_type: 'Course',
tiding_type: 'System', viewed: 0, status: 0
}
Tiding.bulk_insert(*attrs) do |worker|
course.course_member(user).member_teachers.each do |teacher|
worker.add same_attrs.merge(user_id: teacher.user_id)
end
worker.add same_attrs.merge(user_id: score.user_id)
worker.add student_same_attrs.merge(user_id: score.user_id)
end
end
end

@ -56,7 +56,7 @@ class Libraries::SaveService < ApplicationService
destroy_ids = old_attachment_id - attachment_ids
library.attachments.where(id: destroy_ids).delete_all
Attachment.where(id: attachment_ids, author_id: user.id).update_all(container: library)
Attachment.where(id: attachment_ids, author_id: user.id).update_all(container_type: library)
end
def library_params

@ -1,4 +1,4 @@
json.(@subject, :id, :name, :description, :learning_notes, :stages_count, :stage_shixuns_count)
json.(@subject, :id, :name, :description, :learning_notes, :stages_count, :stage_shixuns_count, :shixuns_count)
json.challenge_choose_count @subject.subject_challenge_choose_count
json.challenges_count @subject.subject_challenge_count

@ -18,7 +18,14 @@ json.time tiding.how_long_time
json.new_tiding tiding.unread?(@onclick_time)
json.trigger_user do
json.partial! 'users/user_simple', user: tiding.trigger_user_id.zero? ? User.find(1) : tiding.trigger_user
if tiding.trigger_user_id.zero?
json.id 0
json.name "系统"
json.login ""
json.image_url "educoder/systemLogo.png"
else
json.partial! 'users/user_simple', user: tiding.trigger_user
end
end
json.attachments tiding.attachments, partial: 'attachments/attachment_small', as: :attachment

@ -202,7 +202,7 @@
2_end: "别人对你的匿评发起的申诉申请:%s审核未通过"
StudentWork:
Apply_end: "发起了匿评申诉申请:%s"
HomeworkCommon_end: "有人对你的匿评发起了申诉:%s"
System_end: "有人对你的匿评发起了申诉:%s"
Department_end: "你选填的二级单位:%s%s因不符合规范,已被系统删除.请重新选择"
Library:
Apply_end: "申请发布教学案例:%s"

@ -0,0 +1,18 @@
class ModifyKeContentsForMarkdown < ActiveRecord::Migration[5.2]
# include ActionView::Helpers::SanitizeHelper
def change
# def ke_transform_to_md content
# sanitize(content, tags: %w(img a span), attributes: %w(src href target style))
# .gsub(/^(\n)/, "").gsub(/(\n)+/, "<br />").gsub(/$(\n)/, "")
# .gsub(/(\n)+/, "<br />").gsub("\t", "&nbsp;&nbsp;&nbsp;&nbsp;")
# end
#
# MessageDetail.find_each do |m|
# content = ke_transform_to_md m.content
# puts("content:#{content}")
# m.update_column(:content, content)
# end
end
end

@ -0,0 +1,6 @@
class MigrateAnonymousTidingType < ActiveRecord::Migration[5.2]
def change
Tiding.where(container_type: "StudentWorksScore", extra: "3").update_all(tiding_type: "System", trigger_user_id: 0)
Tiding.where(container_type: "StudentWorksScoresAppeal", parent_container_type: "StudentWork", tiding_type: "HomeworkCommon").update_all(tiding_type: "System", trigger_user_id: 0)
end
end
Loading…
Cancel
Save