xlsx导出增加评语

dev_forum
SylorHuang 5 years ago
commit 409e96e8fd

@ -142,7 +142,7 @@ class AccountsController < ApplicationController
# params[:login] 手机号或者邮箱号
# params[:type]为事件通知类型 1用户注册注册 2忘记密码 3: 绑定手机 4: 绑定邮箱 # 如果有新的继续后面加
# 发送验证码send_type 1注册手机验证码 2找回密码手机验证码 3找回密码邮箱验证码 4绑定手机 5绑定邮箱
# 6手机验证码登录 7邮箱验证码登录 8邮箱注册验证码
# 6手机验证码登录 7邮箱验证码登录 8邮箱注册验证码 9: 验收手机号有效
def get_verification_code
code = %W(0 1 2 3 4 5 6 7 8 9)
value = params[:login]

@ -13,7 +13,7 @@ class CoursesController < ApplicationController
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,
:set_public_or_private, :search_teacher_candidate, :teachers, :apply_teachers,
:top_banner, :left_banner, :add_teacher_popup, :add_teacher,
:graduation_group_list, :create_graduation_group, :join_graduation_group,
:course_group_list, :set_course_group, :change_course_admin, :change_course_teacher,
@ -26,10 +26,10 @@ class CoursesController < ApplicationController
:transfer_to_course_group, :delete_from_course,
:search_users, :add_students_by_search, :get_historical_courses, :add_teacher_popup, :add_teacher]
before_action :admin_allowed, only: [:set_invite_code_halt, :set_public_or_private, :change_course_admin,
:set_course_group, :delete_course_teacher, :teacher_application_review,
:create_group_by_importing_file]
:set_course_group, :delete_course_teacher, :create_group_by_importing_file]
before_action :teacher_or_admin_allowed, only: [:graduation_group_list, :create_graduation_group, :join_graduation_group,
:change_course_teacher, :export_member_scores_excel, :course_group_list]
:change_course_teacher, :export_member_scores_excel, :course_group_list,
:teacher_application_review, :apply_teachers]
before_action :validate_course_name, only: [:create, :update]
before_action :find_board, only: :board_list
before_action :validate_page_size, only: :mine
@ -251,46 +251,53 @@ class CoursesController < ApplicationController
if @course.try(:id) != 1309 || current_user.admin? || current_user.try(:id) == 15582
@teacher_list = @course.course_members.joins(:user).where("course_members.role in (1, 2, 3)
and LOWER(concat(users.lastname, users.firstname)) LIKE '%#{@search_str}%'")
and LOWER(concat(users.lastname, users.firstname)) LIKE ?", "%#{@search_str}%")
else
@teacher_list = @course.course_members.joins(:user).where("(course_members.role in (1, 3) or (course_members.user_id = #{current_user.id}
and course_members.role = 2)) and LOWER(concat(users.lastname, users.firstname))
LIKE '%#{@search_str}%'")
LIKE ?", "%#{@search_str}%")
end
@teacher_list_size = @teacher_list.size
@has_graduation_design = @course.course_modules.graduation_module_not_hidden.any?
sort = params[:sort] || "desc"
@order = params[:order].to_i
if @order.present?
case @order
when 1
@teacher_list = @teacher_list.includes(:user).order("CONVERT(CONCAT(users.lastname, users.firstname) USING gbk) COLLATE gbk_chinese_ci asc")
@teacher_list = @teacher_list.order("role #{sort}")
when 2
@teacher_list = @teacher_list.order("created_at")
@teacher_list = @teacher_list.includes(:user).order("CONVERT(CONCAT(users.lastname, users.firstname) USING gbk) COLLATE gbk_chinese_ci #{sort}")
when 3
@teacher_list = @teacher_list.includes(:course, :graduation_group).order("graduation_groups.name")
@teacher_list = @teacher_list.includes(:course, :graduation_group).order("graduation_groups.name #{sort}")
else
@teacher_list = @teacher_list.order("created_at")
@teacher_list = @teacher_list.order("role #{sort}")
end
else
if @has_graduation_design
@teacher_list = @teacher_list.includes(:course, :graduation_group).order("graduation_groups.name")
else
@teacher_list = @teacher_list.order("created_at")
end
@teacher_list = @teacher_list.order("role #{sort}")
end
@is_admin = @user_course_identity < Course::PROFESSOR
@applications = @is_admin ? CourseMessage.unhandled_join_course_requests_by_course(@course) : CourseMessage.none
@applications_size = CourseMessage.unhandled_join_course_requests_by_course(@course).size
page = params[:page] || 1
limit = params[:limit] || 20
@teacher_list = @teacher_list.page(page).per(limit)
end
def apply_teachers
search_str = params[:search].present? ? params[:search].strip : ""
@applications = CourseMessage.unhandled_join_course_requests_by_course(@course).
joins("join users on course_messages.course_message_id=users.id").
where("LOWER(concat(users.lastname, users.firstname)) LIKE ?", "%#{search_str}%")
@teacher_list_size = @course.teachers.size
@applications_size = CourseMessage.unhandled_join_course_requests_by_course(@course).size
@is_admin = @user_course_identity < Course::PROFESSOR
end
# 打开添加教师或助教弹窗时访问的接口(需要返回该课堂所有答辩组和所有)
def add_teacher_popup
@graduation_groups = @course.graduation_groups
@ -577,6 +584,18 @@ class CoursesController < ApplicationController
end
new_teacher.save!
# 课堂管理员才有分配权限且课堂分班数大于0
if @user_course_identity < Course::PROFESSOR && @course.course_groups_count > 0 && params[:group_id] && params[:group_id].size > 0
# 分班全选则是不限,不需要做处理
unless @course.course_groups.where(id: params[:group_id]).size == @course.course_groups_count
@course.course_groups.where(id: params[:group_id]).each do |group|
unless TeacherCourseGroup.where(course_id: @course.id, user_id: applier_user.id, course_group_id: group.id, course_member_id: new_teacher.id).exists?
TeacherCourseGroup.create(course_id: @course.id, user_id: applier_user.id, course_member_id: new_teacher.id, course_group_id: group.id)
end
end
end
end
elsif approval == 2
course_message.reject!
else

@ -1321,7 +1321,7 @@ class HomeworkCommonsController < ApplicationController
.where(:user_id => user_ids).joins(user: :user_extension)
# 按学号和姓名搜索
if params[:search]
@users_reviews = @users_reviews.where("concat(lastname, firstname) like ? or student_id like ?", params[:search], params[:search])
@users_reviews = @users_reviews.where("concat(lastname, firstname) like :keyword or student_id like :keyword", keyword: "%#{params[:search]}%")
end
# 抄袭作品数
@copy_reviews_count = @users_reviews.count

@ -88,7 +88,7 @@ class PollsController < ApplicationController
@limit = params[:limit] || 15
@polls = @polls.page(@page).per(@limit)
@polls = @polls&.includes(:poll_users,:poll_questions,:poll_group_settings)
@polls = @polls&.includes(:published_settings)
else
@polls = []
end
@ -965,7 +965,7 @@ class PollsController < ApplicationController
if @user_course_identity < Course::STUDENT #当前为老师,而且老师只能查看自己班级的/课堂的问卷
@poll_current_user_status = 0
@poll_users_list = @poll.all_poll_users(current_user.id) #该老师分班的全部学生
get_poll_answers(@poll_users_list)
get_poll_answers(@poll_users_list, @poll_list_status)
if @poll_list_status == 1
@poll_course_groups =[]
else
@ -977,7 +977,7 @@ class PollsController < ApplicationController
end
elsif @user_course_identity > Course::ASSISTANT_PROFESSOR
@poll_all_users = @poll.get_poll_exercise_users
get_poll_answers(@poll_all_users) # 未答和已答的
get_poll_answers(@poll_all_users, @poll_list_status) # 未答和已答的
@poll_course_groups = [] #当为学生的时候,不显示分班情况
@poll_current_user_status = 1 #当前用户的状态,为学生
poll_current_user = @poll_all_users.find_by_group_ids(current_user.id) #当前用户是否开始做问卷(提交/未提交/没做)
@ -988,7 +988,7 @@ class PollsController < ApplicationController
end
else
@poll_all_users = @poll.get_poll_exercise_users
get_poll_answers(@poll_all_users) # 未答和已答的
get_poll_answers(@poll_all_users, @poll_list_status) # 未答和已答的
@poll_current_user_status = 2 #当前用户非课堂成员
@poll_users_list = []
end

@ -631,16 +631,35 @@ class StudentWorksController < ApplicationController
# 查重作品调分
def adjust_review_score
if params[:score].nil? || params[:challenge_id].nil? || params[:code_rate].nil? || params[:copy_user_id].nil?
tip_exception("缺少type参数") if params[:type].blank? || ["review", "report"].include?(params[:type])
if params[:type] == "review" && (params[:score].nil? || params[:challenge_id].nil? || params[:code_rate].nil? || params[:copy_user_id].nil?)
tip_exception("参数错误score和challenge_id和code_rate和copy_user_id不能为空")
elsif params[:type] == "report" && (params[:score].nil? || params[:challenge_id].nil?)
tip_exception("参数错误score和challenge_id")
end
challenge_setting = @homework.homework_challenge_settings.find_by(challenge_id: params[:challenge_id])
challenge = challenge_setting&.challenge
tip_exception("不能小于零") if params[:score] < 0
tip_exception("不能大于关卡分值:#{challenge_setting.score}") if challenge_setting.score < params[:score]
ActiveRecord::Base.transaction do
begin
if params[:type] == "review"
copy_user = User.find params[:copy_user_id]
comment = "代码查重结果显示与#{copy_user.try(:show_real_name)}的代码相似度#{params[:code_rate]}%"
@work.challenge_work_scores.create(challenge_id: params[:challenge_id], user_id: current_user.id, score: params[:score],
else
comment = "根据实训报告中最终提交的代码调整第#{challenge.position}关分数"
end
challenge_score = @work.challenge_work_scores.create(challenge_id: params[:challenge_id], user_id: current_user.id, score: params[:score],
comment: comment)
HomeworksService.new.set_shixun_final_score(@work)
@work_score = @homework.student_works.find_by(id: @work.id).try(:work_score)
challenge_score.create_tiding current_user.id
HomeworksService.new.update_myshixun_work_score @work, @work&.myshixun, @work&.myshixun&.games, @homework, @homework.homework_challenge_settings
rescue Exception => e
uid_logger(e.message)
tip_exception(e.message)
raise ActiveRecord::Rollback
end
end
end

@ -89,11 +89,7 @@ module ExercisesHelper
if ex.question_type <= 2 #单选题
standard_answer = ex.exercise_standard_answers.pluck(:exercise_choice_id) #标准答案的位置
ex.exercise_choices.each do |c|
if standard_answer.include?(c.choice_position) #选项的标准答案为选项的位置
right_answer = true
else
right_answer = false
end
right_answer = standard_answer.include?(c.choice_position) #选项的标准答案为选项的位置
answer_this_choice = effictive_users.search_exercise_answer("exercise_choice_id",c.id)
answer_users_count = answer_this_choice.count
if effictive_users_count == 0
@ -176,11 +172,7 @@ module ExercisesHelper
# zero_scores = all_zero_scores - un_review_scores #已评阅且答案未0分的人数
main_scores_array = [full_scores,no_full_scores,zero_scores,un_review_scores]
main_scores_array.each_with_index do |s,index|
if index == 0
right_answer = true
else
right_answer = false
end
right_answer = (index == 0)
if effictive_users_count == 0 || s < 0
s = 0
score_percent = 0.0
@ -207,11 +199,7 @@ module ExercisesHelper
shixun_score_array = [full_scores,no_full_scores,all_zero_scores]
shixun_chas = []
shixun_score_array.each_with_index do |s,index|
if index == 0
right_answer = true
else
right_answer = false
end
right_answer = (index == 0)
if effictive_users_count == 0
score_percent = 0.0
else

@ -206,7 +206,7 @@ module ExportHelper
head_cells_format = head_cells_format + ["交叉评分"]
end
head_cells_format = head_cells_format + %w(迟交扣分 最终成绩 提交时间 更新时间)
head_cells_format = head_cells_format + %w(迟交扣分 最终成绩 提交时间 更新时间 评语)
@head_cells_column = head_cells_format
@task_cells_column = []
@ -257,8 +257,22 @@ module ExportHelper
w_13 = work.work_score.nil? ? "未评分" : work.work_score.round(1)
w_14 = work.commit_time.present? ? format_time(work.commit_time) : "--"
w_15 = work.update_time.present? ? format_time(work.update_time) : "--"
row_cells_column = [w_1,w_2,w_3,w_3_1,w_4,w_5,w_6,w_7,w_8,w_9,w_10,w_11,w_12,w_13,w_14,w_15]
teacher_comments = work.student_works_scores
if teacher_comments.present?
w_16 = ""
teacher_comments.each do |t|
user_name = t.user&.real_name
user_time = format_time(t.updated_at)
user_score = t&.score
user_comment = t.comment.present? ? t.comment : "--"
comment_title = "教师:#{user_name}\n时间:#{user_time.to_s}\n分数:#{user_score.to_s}\n评语:#{user_comment}\n\n"
# ("教师:" + user_name + "\n" + "时间:" + user_time.to_s + "\n" + "分数:" + user_score.to_s + "分" + "\n" + "评语:" + user_comment + "\n\n")
w_16 = w_16 + comment_title
end
else
w_16 = "--"
end
row_cells_column = [w_1,w_2,w_3,w_3_1,w_4,w_5,w_6,w_7,w_8,w_9,w_10,w_11,w_12,w_13,w_14,w_15,w_16]
row_cells_column = row_cells_column.reject(&:blank?)
@task_cells_column.push(row_cells_column)

@ -1,11 +1,16 @@
module PollsHelper
#获取试卷的已答/未答人数
def get_poll_answers(poll_users)
def get_poll_answers(poll_users, status)
if status == 1
@poll_answers = 0
@poll_unanswers = 0
else
@poll_answers = poll_users.commit_by_status(1).size #表示已经提交了的用户
course_all_members_count = poll_users.size
@poll_unanswers = (course_all_members_count - @poll_answers)
end
end
def poll_votes_count(votes,user_ids)
votes.find_current_vote("user_id",user_ids.uniq).size
@ -59,7 +64,7 @@ module PollsHelper
if is_teacher_or == 1
poll_users_list = poll.all_poll_users(user.id) #当前老师所在班级的全部学生
get_poll_answers(poll_users_list)
get_poll_answers(poll_users_list, poll_status)
ex_pb_time = poll.get_poll_times(user.id,true)
poll_publish_time = ex_pb_time[:publish_time]
poll_end_time = ex_pb_time[:end_time]
@ -67,7 +72,7 @@ module PollsHelper
lock_icon = 0 #不显示锁图标
elsif is_teacher_or == 2
poll_users_list = poll.get_poll_exercise_users
get_poll_answers(poll_users_list) # 未答和已答的
get_poll_answers(poll_users_list, poll_status) # 未答和已答的
# get_poll_answers(poll_all_users)
ex_pb_time = poll.get_poll_times(user.id,false)
poll_publish_time = ex_pb_time[:publish_time]
@ -76,7 +81,7 @@ module PollsHelper
lock_icon = 0 #不显示锁图标
else
poll_users_list = poll.get_poll_exercise_users
get_poll_answers(poll_users_list) # 未答和已答的
get_poll_answers(poll_users_list, poll_status) # 未答和已答的
poll_publish_time = poll.publish_time
poll_end_time = poll.end_time
current_status = 4

@ -2,4 +2,12 @@ class ChallengeWorkScore < ApplicationRecord
belongs_to :user
belongs_to :student_work
belongs_to :challenge
has_many :tidings, as: :container, dependent: :destroy
def create_tiding trigger_user_id
tidings << Tiding.new(user_id: student_work.user_id, trigger_user_id: trigger_user_id, container_id: id,
container_type: "ChallengeWorkScore", parent_container_id: student_work_id,
parent_container_type: "StudentWork", belong_container_id: student_work&.homework_common&.course_id,
belong_container_type: "Course", viewed: 0, tiding_type: "HomeworkCommon")
end
end

@ -258,7 +258,7 @@ class Course < ApplicationRecord
# 是否具有分班权限,返回分班的id
def group_course_power(user_id)
teacher_course_groups.where(user_id: user_id).pluck(:id)
teacher_course_groups.where(user_id: user_id).pluck(:course_group_id)
end
#课程动态公共表记录

@ -42,7 +42,7 @@ class Exercise < ApplicationRecord
if unified_setting #试卷统一设置
exercise_users
else
ex_group_setting_ids = exercise_group_settings.exercise_group_published.pluck(:course_group_id)
ex_group_setting_ids = published_settings.pluck(:course_group_id)
exercise_users.joins("join course_members on exercise_users.user_id=course_members.user_id").
where(course_members: {course_group_id: ex_group_setting_ids})
end
@ -59,15 +59,15 @@ class Exercise < ApplicationRecord
# 根据是否统一发布获取作业的作品列表
def all_works
exercise_users = self.unified_setting ? self.exercise_users :
self.exercise_users.joins("join course_members on exercise_users.user_id=course_members.user_id").
where(course_members: {course_group_id: self.published_settings.pluck(:course_group_id)})
ex_users = unified_setting ? exercise_users :
exercise_users.joins("join course_members on exercise_users.user_id=course_members.user_id").
where(course_members: {course_group_id: published_settings.pluck(:course_group_id)})
end
# 分班权限的老师可见的作品列表
def all_exercise_users user_id
# member = course.course_member(user_id)
teacher_course_groups = course.teacher_course_groups.where(user_id: user_id)
teacher_course_groups = course.teacher_course_groups.get_user_groups(user_id)
ex_users = self.all_works
# 有分班权限的统计管理的分班且已发布的学生情况
if teacher_course_groups.exists?

@ -20,9 +20,9 @@ class Game < ApplicationRecord
#全部关卡数
scope :ch_games, lambda { |challenge_id| where(challenge_id:challenge_id) }
# 已通关的数量
scope :finished_num, -> (challenge_id) { where(:challenge_id => challenge_id, :status => 1)}
scope :finished_num, -> (challenge_id) { where(:challenge_id => challenge_id, :status => 2)}
# 正在通关的数量
scope :doing_num, -> (challenge_id) { where(:challenge_id => challenge_id, :status => 0)}
scope :doing_num, -> (challenge_id) { where(:challenge_id => challenge_id, :status => [0,1])}
#用户的全部关卡
scope :user_games, lambda { |user_id,challenge_id| where("user_id = ? AND challenge_id = ?",user_id,challenge_id) }

@ -100,15 +100,15 @@ class GraduationTask < ApplicationRecord
SELECT count(distinct graduation_work_id) cnt FROM graduation_work_scores WHERE reviewer_role IN(1,2) AND graduation_work_id
IN(SELECT id FROM graduation_works WHERE graduation_task_id = #{self.id} AND user_id
IN(SELECT user_id FROM course_members WHERE role = 4 AND course_group_id
IN(SELECT course_group_id FROM teacher_course_groups WHERE id IN(#{course_group_ids.join(",")}))
IN(#{course_group_ids.join(",")})
)
)
}
else
%Q{
SELECT COUNT(distinct graduation_work_id) cnt FROM graduation_works gw
JOIN graduation_work_scores gwc ON gw.graduation_task_id = gwc.graduation_task_id
WHERE reviewer_role IN(1,2) AND gwc.graduation_task_id = #{self.id}
JOIN graduation_work_scores gwc ON gw.id = gwc.graduation_work_id
WHERE reviewer_role IN(1,2) AND gw.graduation_task_id = #{self.id}
}
end
GraduationWorkScore.find_by_sql(sql).first.try(:cnt).to_i
@ -127,7 +127,7 @@ class GraduationTask < ApplicationRecord
sql = %Q{
SELECT count(*) cnt FROM graduation_works gw WHERE work_status = 0 AND gw.graduation_task_id = #{self.id} AND gw.user_id
IN( SELECT user_id FROM course_members WHERE role = 4 AND course_group_id
IN( SELECT course_group_id FROM teacher_course_groups WHERE id not IN(#{course_group_ids.join(",")}) )
IN(#{course_group_ids.join(",")})
)
}
GraduationWork.find_by_sql(sql).first.try(:cnt)
@ -144,7 +144,7 @@ class GraduationTask < ApplicationRecord
sql = %Q{
SELECT count(*) cnt FROM graduation_works gw WHERE work_status = 1 AND gw.graduation_task_id = #{self.id} AND gw.user_id
IN( SELECT user_id FROM course_members WHERE role = 4 AND course_group_id
IN( SELECT course_group_id FROM teacher_course_groups WHERE id IN(#{course_group_ids.join(",")}) )
IN(#{course_group_ids.join(",")})
)
}
GraduationWork.find_by_sql(sql).first.try(:cnt)
@ -160,7 +160,7 @@ class GraduationTask < ApplicationRecord
sql = %Q{
SELECT count(*) cnt FROM graduation_works gw WHERE work_status = 2 AND gw.graduation_task_id = #{self.id} AND gw.user_id
IN( SELECT user_id FROM course_members WHERE role = 4 AND course_group_id
IN( SELECT course_group_id FROM teacher_course_groups WHERE id IN(#{course_group_ids.join(",")}) )
IN(#{course_group_ids.join(",")})
)
}
GraduationWork.find_by_sql(sql).first.try(:cnt)

@ -197,7 +197,7 @@ class HomeworkCommon < ApplicationRecord
JOIN student_works_scores sws on sws.student_work_id = sw.id WHERE
reviewer_role IN(1,2) AND sw.id IN (SELECT id FROM student_works WHERE homework_common_id = #{self.id}
AND user_id IN (SELECT user_id FROM course_members WHERE role = 4 AND course_group_id
IN (SELECT course_group_id FROM teacher_course_groups WHERE id IN(#{course_group_ids.join(",")}))
IN (#{course_group_ids.join(",")})
)
)
}

@ -8,6 +8,7 @@ class Poll < ApplicationRecord
has_many :poll_users, -> { where("is_delete != 1") }, :dependent => :delete_all
has_many :users, :through => :poll_users #该文件被哪些用户提交答案过
has_many :poll_group_settings, :dependent => :delete_all
has_many :published_settings, -> { poll_group_published }, class_name: "PollGroupSetting"
has_many :course_acts, class_name: 'CourseActivity', as: :course_act, dependent: :delete_all
has_many :tidings, as: :container, dependent: :delete_all
@ -44,21 +45,48 @@ class Poll < ApplicationRecord
if unified_setting #试卷统一设置
poll_users
else
<<<<<<< HEAD
ex_group_setting_ids = poll_group_settings.poll_group_published.select(:course_group_id).pluck(:course_group_id)
poll_users.where(user_id: course.students.where(course_group_id:ex_group_setting_ids).select(:user_id).pluck(:user_id).uniq)
=======
ex_group_setting_ids = published_settings.pluck(:course_group_id)
poll_users.joins("join course_members on poll_users.user_id=course_members.user_id").
where(course_members: {course_group_id: ex_group_setting_ids})
>>>>>>> 8bee375b67a224e583b9cfe56507ee1fea7684f8
end
end
# 统一设置,为当前老师有权限的分班学生,分班设置,也为当前老师有权限的分班的学生
def all_poll_users(user_id)
poll_all_users = poll_users
group_ids = poll_published_ids(user_id)
if group_ids.present?
poll_all_users = poll_all_users.where(user_id: course.students.where(course_group_id: group_ids).select(:user_id).pluck(:user_id).uniq)
# 根据是否统一发布获取作业的作品列表
def all_works
po_users = unified_setting ? poll_users :
poll_users.joins("join course_members on poll_users.user_id=course_members.user_id").
where(course_members: {course_group_id: published_settings.pluck(:course_group_id)})
end
poll_all_users
# 分班权限的老师可见的作品列表
def all_poll_users user_id
# member = course.course_member(user_id)
teacher_course_groups = course.teacher_course_groups.get_user_groups(user_id)
poll_users = self.all_works
# 有分班权限的统计管理的分班且已发布的学生情况
if teacher_course_groups.exists?
group_ids = teacher_course_groups.pluck(:course_group_id)
poll_users = poll_users.joins("join course_members on poll_users.user_id=course_members.user_id").
where(course_members: {course_group_id: group_ids})
end
poll_users
end
# # 统一设置,为当前老师有权限的分班学生,分班设置,也为当前老师有权限的分班的学生
# def all_poll_users(user_id)
# poll_all_users = poll_users
# group_ids = poll_published_ids(user_id)
# if group_ids.present?
# poll_all_users = poll_all_users.where(user_id: course.students.where(course_group_id: group_ids).select(:user_id).pluck(:user_id).uniq)
# end
# poll_all_users
# end
#当前用户已发布的班级id和试卷分组已发布的班级id的交集
def poll_published_ids(user_id)
current_user_groups = course.teacher_course_ids(user_id)

@ -1,2 +1,2 @@
json.status 0
json.right_url course_board_messages_path(@course, @course_board)
json.right_url board_messages_path(@course_board)

@ -0,0 +1,13 @@
json.teacher_list_size @teacher_list_size
json.apply_size @applications_size
json.is_admin @is_admin
json.application_list do
json.array! @applications do |application|
json.application_id application.id
json.user_id application.course_message_id
json.name application.application_user.real_name
json.name_link user_path(application.application_user)
json.login application.application_user.login
json.role application.content.to_i == 3 || application.content.to_i == 7 ? "助教" : application.content.to_i == 2 || application.content.to_i == 9 ? "教师" : ""
end
end

@ -17,14 +17,5 @@ json.teacher_list do
end
end
json.teacher_list_size @teacher_list_size
json.application_list do
json.array! @applications do |application|
json.application_id application.id
json.user_id application.course_message_id
json.name application.application_user.real_name
json.name_link user_path(application.application_user)
json.login application.application_user.login
json.role application.content.to_i == 3 || application.content.to_i == 7 ? "助教" : application.content.to_i == 2 || application.content.to_i == 9 ? "教师" : ""
end
end
json.apply_size @applications_size
json.is_admin @is_admin

@ -3,6 +3,8 @@ json.task_type @task.task_type
json.work_id @work.id
json.description @work.description
json.user_name @task_user.real_name
json.max_num @task.max_num
json.min_num @task.min_num
json.attachments @work.attachments do |atta|
json.partial! "attachments/attachment_simple", locals: {attachment: atta, delete: @work.delete_atta(atta)}

@ -6,4 +6,6 @@ if @task.task_type == 2
json.user_id @user.id
json.user_student_id @user.student_id
json.group_name @course.course_member(@user.id).try(:course_group_name)
json.max_num @task.max_num
json.min_num @task.min_num
end

@ -0,0 +1,3 @@
json.status 0
json.message "调分成功"
json.work_score @work.work_score

@ -24,6 +24,7 @@ if @shixun
json.myself_experience game.final_score
json.experience game.challenge.all_score
json.complete_status game_status(game, @homework)
json.challenge_id game.challenge_id
end
end

@ -295,6 +295,7 @@ Rails.application.routes.draw do
get 'course_group_list'
get 'add_teacher_popup'
get 'teachers'
get 'apply_teachers'
get 'graduation_group_list'
get 'top_banner'
get 'left_banner'

Loading…
Cancel
Save