dev_course
SylorHuang 5 years ago
parent ddd24d9aca
commit 16f53062ee

@ -32,13 +32,9 @@ class ExercisesController < ApplicationController
@exercises_all = @course.exercises
member_show_exercises = @exercises_all.is_exercise_published #已发布的或已截止的试卷
@current_user_ = current_user
@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.size #当前课堂的学生数
@current_student = @course_all_members.course_find_by_ids("user_id",current_user.id) #当前用户是否为课堂的学生
# exercises的不同用户群体的显示
@ -63,6 +59,7 @@ class ExercisesController < ApplicationController
@is_teacher_or = 0
@exercises = member_show_exercises.exists? ? member_show_exercises.unified_setting : []
end
if @exercises.size > 0
if params[:type].present?
choose_type = params[:type].to_i
@ -105,6 +102,12 @@ class ExercisesController < ApplicationController
@exercises = []
end
@course_all_members_count = @course_all_members.size #当前课堂的学生数
@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 #已截止的试卷数
rescue Exception => e
uid_logger_error(e.message)
tip_exception(e.message)

@ -207,8 +207,8 @@ class HomeworkCommonsController < ApplicationController
format.xlsx{
student_work_to_xlsx(@work_excel,@homework)
exercise_export_name = current_user.real_name + "_" + @course.name + "_" + @homework.name + "_" + Time.now.strftime('%Y%m%d_%H%M%S')
response.set_header("Content-Disposition","attachment; filename=#{exercise_export_name.strip.first(30)}};filename*=utf-8''#{exercise_export_name.strip.first(30)}}")
file_name = Base64.urlsafe_encode64(exercise_export_name.strip.first(30))
# response.set_header("Content-Disposition","attachment; filename=#{exercise_export_name.strip.first(30)}};filename*=utf-8''#{exercise_export_name.strip.first(30)}}")
file_name = Base64.encode64(exercise_export_name.strip.first(30))
# response.setHeader['Content-Disposition'] = "attachment; filename=\"#{exercise_export_name.strip.first(30)}\""
render xlsx: "#{file_name}",template: "homework_commons/works_list.xlsx.axlsx",locals:
{table_columns: @work_head_cells,task_users: @work_cells_column}

@ -1,22 +1,4 @@
json.exercises_counts do
json.exercises_total_counts @exercises_count #全部试卷数
json.exercises_all_counts @exercises_select_count #选择后的全部试卷数
json.exercises_unpublish_counts @exercises_unpublish_counts #未发布试卷数
json.exercises_published_counts @exercises_published_counts #已发布试卷数
json.exercises_ended_counts @exercises_ended_counts #已截止试卷数
json.left_banner_id @left_banner_id
json.left_banner_name @left_banner_name
end
json.course_types do
json.course_status @course.is_end ? 1 : 0 #课堂的当前是否结束如结束则为1否则为0
json.course_end_time @course.end_date #课堂的截止时间
json.course_is_public @course.is_public #判断课堂是否为公开,只有公开课才有设为公开的按钮
json.user_permission @is_teacher_or # 当前用户存在且为课堂教师/管理员/超级管理员时为1 课堂成员为2否则为0
end
if @exercises_count > 0
json.exercises do
json.array! @exercises do |exercise|
@ -43,3 +25,22 @@ else
json.exercises []
end
json.course_types do
json.course_status @course.is_end ? 1 : 0 #课堂的当前是否结束如结束则为1否则为0
json.course_end_time @course.end_date #课堂的截止时间
json.course_is_public @course.is_public #判断课堂是否为公开,只有公开课才有设为公开的按钮
json.user_permission @is_teacher_or # 当前用户存在且为课堂教师/管理员/超级管理员时为1 课堂成员为2否则为0
end
json.exercises_counts do
json.exercises_total_counts @exercises_count #全部试卷数
json.exercises_all_counts @exercises_select_count #选择后的全部试卷数
json.exercises_unpublish_counts @exercises_unpublish_counts #未发布试卷数
json.exercises_published_counts @exercises_published_counts #已发布试卷数
json.exercises_ended_counts @exercises_ended_counts #已截止试卷数
json.left_banner_id @left_banner_id
json.left_banner_name @left_banner_name
end

Loading…
Cancel
Save