Merge branches 'dev_aliyun' and 'dev_chen' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_chen

PCqiandao
杨树明 5 years ago
commit 0542798625

@ -114,6 +114,8 @@ class Weapps::AttendancesController < ApplicationController
@course_members = @course.students if @_is_current_attendance
@all_attendances = @attendance.course_member_attendances
@user = @attendance.user
end
def update

@ -81,6 +81,8 @@ module CoursesHelper
"/classrooms/#{course.id}/statistics"
when "video"
"/classrooms/#{course.id}/course_videos"
when "attendance"
"/classrooms/#{course.id}/signin"
end
end
@ -131,31 +133,33 @@ module CoursesHelper
# 课堂模块的任务数
def course_task_count(course, module_type)
case module_type
when "shixun_homework"
get_homework_commons_count(course, 4, 0)
when "common_homework"
get_homework_commons_count(course, 1, 0)
when "group_homework"
get_homework_commons_count(course, 3, 0)
when "graduation"
0
when "exercise"
course.exercises_count
when "poll"
course.polls_count
when "attachment"
get_attachment_count(course, 0)
when "board"
course_board = course.course_board
course_board.present? ? course_board.messages.size : 0
when "course_group"
course.course_groups_count
when "announcement"
course.informs.count
when "online_learning"
course.shixuns.count
when "video"
course.videos_count + course.live_links.count
when "shixun_homework"
get_homework_commons_count(course, 4, 0)
when "common_homework"
get_homework_commons_count(course, 1, 0)
when "group_homework"
get_homework_commons_count(course, 3, 0)
when "graduation"
0
when "exercise"
course.exercises_count
when "poll"
course.polls_count
when "attachment"
get_attachment_count(course, 0)
when "board"
course_board = course.course_board
course_board.present? ? course_board.messages.size : 0
when "course_group"
course.course_groups_count
when "announcement"
course.informs.count
when "online_learning"
course.shixuns.count
when "video"
course.videos_count + course.live_links.count
when "attendance"
course.course_attendances.count
end
end

@ -226,7 +226,7 @@ class Course < ApplicationRecord
end
def all_course_module_types
%w[activity announcement online_learning shixun_homework common_homework group_homework exercise attachment course_group graduation poll board statistics video]
%w[activity announcement online_learning shixun_homework common_homework group_homework exercise attachment course_group graduation poll board statistics video attendance]
end
def get_course_module_by_type(type)
@ -429,6 +429,7 @@ class Course < ApplicationRecord
when 'video' then '视频直播'
when 'board' then '讨论'
when 'course_group' then '分班'
when 'attendance' then '签到'
when 'statistics' then '统计'
else ''
end
@ -449,7 +450,8 @@ class Course < ApplicationRecord
when 'video' then 11
when 'board' then 12
when 'course_group' then 13
when 'statistics' then 14
when 'attendance' then 14
when 'statistics' then 15
else 100
end
end

@ -9,6 +9,10 @@ json.name @attendance.name
json.attendance_date @attendance.attendance_date.strftime("%Y-%m-%d")
json.start_time @attendance.start_time.strftime("%H:%M")
json.end_time @attendance.end_time.strftime("%H:%M")
json.author do
json.user_name @user.real_name
json.user_login @user.login
end
# json.course_groups @group_ids do |group|
# json.(group, :id, :name, :course_members_count)

@ -0,0 +1,16 @@
class AddAttendanceToCourseModule < ActiveRecord::Migration[5.2]
def change
Course.all.each do |course|
unless course.course_modules.exists?(module_type: "attendance")
atta_position = course.course_modules.find_by(module_type: 'course_group')&.position.to_i
attendance_position = atta_position != 0 ? (atta_position + 1) : 14
course.course_modules.where("position >= #{attendance_position}").update_all("position = position + 1")
if course.is_end
course.course_modules << CourseModule.new(module_type: "attendance", hidden: 1, module_name: "签到", position: attendance_position)
else
course.course_modules << CourseModule.new(module_type: "attendance", hidden: 0, module_name: "签到", position: attendance_position)
end
end
end
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Loading…
Cancel
Save