Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_ysthree
commit
94950e8ea0
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,25 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('.weapp-banner-setting-container').length > 0) {
|
||||
var $form = $('#course_form');
|
||||
|
||||
$('.course.banner-item-bottom').on("change", 'input[type="file"]', function() {
|
||||
var $fileInput = $(this);
|
||||
var file = this.files[0];
|
||||
var imageType = /image.*/;
|
||||
if (file && file.type.match(imageType)) {
|
||||
$form.ajaxSubmit()
|
||||
}
|
||||
});
|
||||
|
||||
var $shixunform = $('#shixun_form');
|
||||
|
||||
$('.shixun.banner-item-bottom').on("change", 'input[type="file"]', function() {
|
||||
var $fileInput = $(this);
|
||||
var file = this.files[0];
|
||||
var imageType = /image.*/;
|
||||
if (file && file.type.match(imageType)) {
|
||||
$shixunform.ajaxSubmit()
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
@ -1,171 +1,154 @@
|
||||
.admins-laboratories-index-page {
|
||||
.laboratory-list-table {
|
||||
.member-container {
|
||||
.laboratory-user {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.laboratory-user-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 22px;
|
||||
line-height: 22px;
|
||||
padding: 2px 5px;
|
||||
margin: 2px 2px;
|
||||
border: 1px solid #91D5FF;
|
||||
background-color: #E6F7FF;
|
||||
color: #91D5FF;
|
||||
border-radius: 4px;
|
||||
.laboratory-list-table {
|
||||
.member-container {
|
||||
.laboratory-user {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
.laboratory-user-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 22px;
|
||||
line-height: 22px;
|
||||
padding: 2px 5px;
|
||||
margin: 2px 2px;
|
||||
border: 1px solid #91D5FF;
|
||||
background-color: #E6F7FF;
|
||||
color: #91D5FF;
|
||||
border-radius: 4px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.admins-laboratory-settings-show-page, .admins-laboratory-settings-update-page {
|
||||
.edit-laboratory-setting-container {
|
||||
.logo-item {
|
||||
display: flex;
|
||||
|
||||
&-img {
|
||||
display: block;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
background: #f0f0f0;
|
||||
}
|
||||
|
||||
&-upload {
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
background: #F5F5F5;
|
||||
border: 1px solid #E5E5E5;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 27px;
|
||||
left: 39px;
|
||||
width: 2px;
|
||||
height: 26px;
|
||||
background: #E5E5E5;
|
||||
}
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 39px;
|
||||
left: 27px;
|
||||
width: 26px;
|
||||
height: 2px;
|
||||
background: #E5E5E5;
|
||||
}
|
||||
}
|
||||
|
||||
&-left {
|
||||
position: relative;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
|
||||
&.has-img {
|
||||
.logo-item-upload {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.logo-item-upload {
|
||||
display: block;
|
||||
background: rgba(145, 145, 145, 0.8);
|
||||
.admins-laboratory-settings-show-page,
|
||||
.admins-laboratory-settings-update-page,
|
||||
.weapp-banner-setting-container {
|
||||
.edit-laboratory-setting-container {
|
||||
.logo-item {
|
||||
display: flex;
|
||||
&-img {
|
||||
display: block;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
background: #f0f0f0;
|
||||
}
|
||||
&-upload {
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
background: #F5F5F5;
|
||||
border: 1px solid #E5E5E5;
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 27px;
|
||||
left: 39px;
|
||||
width: 2px;
|
||||
height: 26px;
|
||||
background: #E5E5E5;
|
||||
}
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 39px;
|
||||
left: 27px;
|
||||
width: 26px;
|
||||
height: 2px;
|
||||
background: #E5E5E5;
|
||||
}
|
||||
}
|
||||
&-left {
|
||||
position: relative;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
&.has-img {
|
||||
.logo-item-upload {
|
||||
display: none;
|
||||
}
|
||||
&:hover {
|
||||
.logo-item-upload {
|
||||
display: block;
|
||||
background: rgba(145, 145, 145, 0.8);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&-right {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
color: #777777;
|
||||
font-size: 12px;
|
||||
}
|
||||
&-title {
|
||||
color: #23272B;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-right {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
color: #777777;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
&-title {
|
||||
color: #23272B;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.banner-item {
|
||||
margin-bottom: 15px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
&-img {
|
||||
display: block;
|
||||
width: 300px;
|
||||
height: 80px;
|
||||
background: #f0f0f0;
|
||||
}
|
||||
|
||||
&-upload {
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 300px;
|
||||
height: 80px;
|
||||
background: #F5F5F5;
|
||||
border: 1px solid #E5E5E5;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 27px;
|
||||
left: 149px;
|
||||
width: 2px;
|
||||
height: 26px;
|
||||
background: #E5E5E5;
|
||||
}
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 39px;
|
||||
left: 137px;
|
||||
width: 26px;
|
||||
height: 2px;
|
||||
background: #E5E5E5;
|
||||
}
|
||||
}
|
||||
|
||||
&-top {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
&-bottom {
|
||||
position: relative;
|
||||
width: 300px;
|
||||
height: 80px;
|
||||
|
||||
&.has-img {
|
||||
.banner-item-upload {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.banner-item-upload {
|
||||
display: block;
|
||||
background: rgba(145, 145, 145, 0.8);
|
||||
.banner-item {
|
||||
margin-bottom: 15px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
&-img {
|
||||
display: block;
|
||||
width: 300px;
|
||||
height: 80px;
|
||||
background: #f0f0f0;
|
||||
}
|
||||
&-upload {
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 300px;
|
||||
height: 80px;
|
||||
background: #F5F5F5;
|
||||
border: 1px solid #E5E5E5;
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 27px;
|
||||
left: 149px;
|
||||
width: 2px;
|
||||
height: 26px;
|
||||
background: #E5E5E5;
|
||||
}
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 39px;
|
||||
left: 137px;
|
||||
width: 26px;
|
||||
height: 2px;
|
||||
background: #E5E5E5;
|
||||
}
|
||||
}
|
||||
&-top {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
&-bottom {
|
||||
position: relative;
|
||||
width: 300px;
|
||||
height: 80px;
|
||||
&.has-img {
|
||||
.banner-item-upload {
|
||||
display: none;
|
||||
}
|
||||
&:hover {
|
||||
.banner-item-upload {
|
||||
display: block;
|
||||
background: rgba(145, 145, 145, 0.8);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&-title {
|
||||
color: #23272B;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-title {
|
||||
color: #23272B;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,80 +1,52 @@
|
||||
class Admins::WeappBannersController < Admins::BaseController
|
||||
before_action :convert_file!, only: [:create]
|
||||
|
||||
def index
|
||||
|
||||
@shixun = WeappSettings::ShixunBanner.first
|
||||
@course = WeappSettings::CourseBanner.first
|
||||
end
|
||||
|
||||
def create
|
||||
position = WeappSettings::Carousel.count + 1
|
||||
|
||||
ActiveRecord::Base.transaction do
|
||||
carousel = WeappSettings::Carousel.create!(create_params.merge(position: position))
|
||||
old_carouse = WeappSettings::CourseBanner.first
|
||||
|
||||
file_path = Util::FileManage.source_disk_filename(carousel)
|
||||
File.delete(file_path) if File.exist?(file_path) # 删除之前的文件
|
||||
Util.write_file(@file, file_path)
|
||||
end
|
||||
if old_carouse.present?
|
||||
old_carouse.destroy!
|
||||
file_path = Util::FileManage.source_disk_filename(old_carouse)
|
||||
File.delete(file_path) if File.exist?(file_path) # 删除之前的文件
|
||||
end
|
||||
|
||||
flash[:success] = '保存成功'
|
||||
redirect_to admins_weapp_carousels_path
|
||||
@course = WeappSettings::CourseBanner.create!
|
||||
save_image_file(params[:course_banner], @course)
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
current_carousel.update!(update_params)
|
||||
render_ok
|
||||
end
|
||||
|
||||
def destroy
|
||||
def shixun_banner
|
||||
ActiveRecord::Base.transaction do
|
||||
current_carousel.destroy!
|
||||
# 前移
|
||||
WeappSettings::Carousel.where('position > ?', current_carousel.position)
|
||||
.update_all('position = position - 1')
|
||||
old_shixun = WeappSettings::ShixunBanner.first
|
||||
|
||||
if old_shixun.present?
|
||||
old_shixun.destroy!
|
||||
file_path = Util::FileManage.source_disk_filename(old_shixun)
|
||||
File.delete(file_path) if File.exist?(file_path) # 删除之前的文件
|
||||
end
|
||||
|
||||
file_path = Util::FileManage.source_disk_filename(current_carousel)
|
||||
File.delete(file_path) if File.exist?(file_path)
|
||||
@shixun = WeappSettings::ShixunBanner.create!
|
||||
save_image_file(params[:shixun_banner], @shixun)
|
||||
end
|
||||
render_delete_success
|
||||
end
|
||||
|
||||
def drag
|
||||
move = WeappSettings::Carousel.find_by(id: params[:move_id])
|
||||
after = WeappSettings::Carousel.find_by(id: params[:after_id])
|
||||
|
||||
Admins::DragWeappCarouselService.call(move, after)
|
||||
render_ok
|
||||
rescue ApplicationService::Error => e
|
||||
render_error(e.message)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_carousel
|
||||
@_current_carousel ||= WeappSettings::Carousel.find(params[:id])
|
||||
end
|
||||
private
|
||||
|
||||
def create_params
|
||||
params.require(:weapp_settings_carousel).permit(:link)
|
||||
end
|
||||
def save_image_file(file, model)
|
||||
return unless file.present? && file.is_a?(ActionDispatch::Http::UploadedFile)
|
||||
|
||||
def update_params
|
||||
params.permit(:link, :online)
|
||||
file_path = Util::FileManage.source_disk_filename(model)
|
||||
File.delete(file_path) if File.exist?(file_path) # 删除之前的文件
|
||||
Util.write_file(file, file_path)
|
||||
end
|
||||
|
||||
def convert_file!
|
||||
max_size = 10 * 1024 * 1024 # 10M
|
||||
file = params.dig('weapp_settings_carousel', 'image')
|
||||
if file.class == ActionDispatch::Http::UploadedFile
|
||||
@file = file
|
||||
render_error('请上传文件') if @file.size.zero?
|
||||
render_error('文件大小超过限制') if @file.size > max_size
|
||||
else
|
||||
file = file.to_s.strip
|
||||
return render_error('请上传正确的图片') if file.blank?
|
||||
@file = Util.convert_base64_image(file, max_size: max_size)
|
||||
end
|
||||
rescue Base64ImageConverter::Error => ex
|
||||
render_error(ex.message)
|
||||
end
|
||||
end
|
@ -0,0 +1,84 @@
|
||||
class Weapps::AttendancesController < ApplicationController
|
||||
before_action :require_login
|
||||
before_action :find_course, only: [:create, :index, :student_attendances]
|
||||
before_action :find_attendance, except: [:create, :index, :student_attendances]
|
||||
before_action :user_course_identity
|
||||
before_action :teacher_allowed, only: [:create]
|
||||
|
||||
def create
|
||||
ActiveRecord::Base.transaction do
|
||||
attendance = @course.course_attendances.create!(create_params.merge(user_id: current_user.id))
|
||||
unless params[:group_ids].blank?
|
||||
group_ids = @course.charge_group_ids(current_user) & params[:group_ids]
|
||||
group_ids.each do |group_id|
|
||||
@course.course_attendance_groups.create!(course_group_id: group_id, course_attendance: attendance)
|
||||
end
|
||||
else
|
||||
@course.course_attendance_groups.create!(course_group_id: 0, course_attendance: attendance)
|
||||
end
|
||||
render_ok({attendance_id: attendance.id})
|
||||
end
|
||||
end
|
||||
|
||||
def index
|
||||
|
||||
end
|
||||
|
||||
def student_attendances
|
||||
tip_exception(403, "") if @user_course_identity != Course::STUDENT
|
||||
member = @course.students.find_by(user_id: current_user.id)
|
||||
current_date = Date.current
|
||||
current_end_time = Time.current.strftime("%H:%M:%S")
|
||||
|
||||
# 先算出该学生所在分班的签到id
|
||||
# 分班id为0 表示签到不限制分班
|
||||
group_ids = [member&.course_group_id.to_i, 0]
|
||||
all_attendance_ids = @course.course_attendance_groups.where(course_group_id: group_ids).pluck(:course_attendance_id)
|
||||
|
||||
@history_attendances = @course.course_attendances.where(id: all_attendance_ids.uniq).
|
||||
where("attendance_date < '#{current_date}' or (attendance_date = '#{current_date}' and end_time < '#{current_end_time}')").order("id desc")
|
||||
@current_attendance = @course.course_attendances.where(id: all_attendance_ids.uniq).
|
||||
where("attendance_date = '#{current_date}' and start_time <= '#{current_end_time}' and end_time > '#{current_end_time}'").take
|
||||
@history_count = @history_attendances.size
|
||||
|
||||
student_attendance_ids = @history_attendances.pluck(:id)
|
||||
student_attendance_ids += @current_attendance.present? ? [@current_attendance.id] : []
|
||||
|
||||
if student_attendance_ids.uniq.blank?
|
||||
@normal_count = 0
|
||||
@leave_count = 0
|
||||
@absence_count = 0
|
||||
else
|
||||
@normal_count = @course.course_member_attendances.where(course_attendance_id: student_attendance_ids, attendance_status: 1).size
|
||||
@leave_count = @course.course_member_attendances.where(course_attendance_id: student_attendance_ids, attendance_status: 2).size
|
||||
@absence_count = student_attendance_ids.uniq.size - @normal_count - @leave_count
|
||||
end
|
||||
|
||||
@all_history_count = @history_attendances.size
|
||||
@history_attendances = paginate @history_attendances.includes(:course_member_attendances)
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
tip_exception(403, "") unless @user_course_identity < Course::PROFESSOR || @attendance.user_id == current_user.id
|
||||
@attendance.update!(name: params[:name])
|
||||
render_ok
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
def create_params
|
||||
params.permit(:name, :mode, :attendance_date, :start_time, :end_time)
|
||||
end
|
||||
|
||||
def find_attendance
|
||||
@attendance = CourseAttendance.find params[:id]
|
||||
@course = @attendance.course
|
||||
end
|
||||
end
|
@ -0,0 +1,12 @@
|
||||
class Weapps::BannersController < Weapps::BaseController
|
||||
|
||||
def index
|
||||
shixun = WeappSettings::ShixunBanner.first
|
||||
course = WeappSettings::CourseBanner.first
|
||||
|
||||
render json: {
|
||||
shixun_img: shixun ? Util::FileManage.source_disk_file_url(shixun) : '',
|
||||
course_img: course ? Util::FileManage.source_disk_file_url(course) : ''
|
||||
}
|
||||
end
|
||||
end
|
@ -0,0 +1,31 @@
|
||||
class Weapps::CourseMemberAttendancesController < ApplicationController
|
||||
before_action :require_login
|
||||
|
||||
def create
|
||||
tip_exception("签到码不能为空") if params[:code].blank?
|
||||
tip_exception("attendance_mode参数不对") if [1, 2].include?(params[:attendance_mode])
|
||||
|
||||
attendance = CourseAttendance.find_by(attendance_code: params[:code])
|
||||
tip_exception("签到码输入有误") if attendance.blank? || attendance.course.blank?
|
||||
|
||||
member = attendance.course.students.find_by(user_id: current_user.id)
|
||||
tip_exception("签到码输入有误") if member.blank?
|
||||
|
||||
start_time = "#{attendance.attendance_date} #{attendance.start_time}".to_time
|
||||
end_time = "#{attendance.attendance_date} #{attendance.end_time}".to_time
|
||||
Rails.logger.info("##############{start_time} #{end_time}")
|
||||
tip_exception("不在签到时间内") unless start_time < Time.current && Time.current < end_time
|
||||
|
||||
current_attendance = attendance.course_member_attendances.find_by(user_id: current_user.id)
|
||||
tip_exception("请勿重复签到") if current_attendance.present? && current_attendance.attendance_status == 1
|
||||
tip_exception("您当前是请假状态,无法签到") if current_attendance.present? && current_attendance.attendance_status == 2
|
||||
tip_exception("您当前是旷课状态,无法签到") if current_attendance.present? && current_attendance.attendance_status == 0
|
||||
|
||||
unless current_attendance.present?
|
||||
attendance.course_member_attendances.create!(course_member_id: member.id, user_id: current_user.id, course_id: attendance.course_id,
|
||||
course_group_id: member.course_group_id, attendance_status: 1, attendance_mode: params[:attendance_mode] || 2)
|
||||
end
|
||||
render_ok
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,7 @@
|
||||
module Weapps::AttendancesHelper
|
||||
|
||||
def student_attendance_status attendance, user
|
||||
st_attendance = attendance.course_member_attendances.find_by(user_id: user.id)
|
||||
st_attendance.present? ? st_attendance.attendance_status : 0
|
||||
end
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
class CourseAttendanceGroup < ApplicationRecord
|
||||
belongs_to :course
|
||||
belongs_to :course_attendance
|
||||
belongs_to :course_group, optional: true
|
||||
end
|
@ -0,0 +1,3 @@
|
||||
class WeappSettings::CourseBanner < WeappSetting
|
||||
default_scope { order(position: :asc) }
|
||||
end
|
@ -0,0 +1,3 @@
|
||||
class WeappSettings::ShixunBanner < WeappSetting
|
||||
default_scope { order(position: :asc) }
|
||||
end
|
@ -0,0 +1,2 @@
|
||||
$("#course_img")[0].innerHTML = "<%= escape_javascript(image_tag Util::FileManage.source_disk_file_url(@course), class: 'banner-item-img course-banner-img') %>";
|
||||
$("#course_img_banner").addClass('has-img');
|
@ -0,0 +1,2 @@
|
||||
$("#shixun_img")[0].innerHTML = "<%= escape_javascript(image_tag Util::FileManage.source_disk_file_url(@shixun), class: 'banner-item-img course-banner-img') %>";
|
||||
$("#shixun_img_banner").addClass('has-img');
|
@ -1,4 +1,4 @@
|
||||
json.status 1
|
||||
json.message "发送成功"
|
||||
json.course_id @course.id
|
||||
json.first_category_url module_url(@course.none_hidden_course_modules.first, @course)
|
||||
json.first_category_url module_url(@course.shixun_course_modules.first, @course)
|
@ -1,3 +1,3 @@
|
||||
json.status 1
|
||||
json.message "发送成功"
|
||||
json.url module_url(@course.none_hidden_course_modules.first, @course)
|
||||
json.url module_url(@course.shixun_course_modules.first, @course)
|
@ -0,0 +1,5 @@
|
||||
json.(attendance, :name, :mode)
|
||||
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.attendance_status student_attendance_status(attendance, User.current)
|
@ -0,0 +1,12 @@
|
||||
json.current_attendance do
|
||||
json.partial! 'student_attendance', locals: {attendance: @current_attendance} if @current_attendance.present?
|
||||
end
|
||||
|
||||
json.history_attendances @history_attendances do |attendance|
|
||||
json.partial! 'student_attendance', locals: {attendance: attendance}
|
||||
end
|
||||
|
||||
json.all_history_count @all_history_count
|
||||
json.normal_count @normal_count
|
||||
json.leave_count @leave_count
|
||||
json.absence_count @absence_count
|
@ -0,0 +1,16 @@
|
||||
class CreateCourseAttendances < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :course_attendances do |t|
|
||||
t.references :course, index: true
|
||||
t.references :user, index: true
|
||||
t.string :name
|
||||
t.integer :mode, limit: 1, default: 0
|
||||
t.date :attendance_date
|
||||
t.time :start_time
|
||||
t.time :end_time
|
||||
t.string :attendance_code
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,14 @@
|
||||
class CreateCourseAttendanceGroups < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :course_attendance_groups do |t|
|
||||
t.references :course, index: true
|
||||
t.references :course_attendance
|
||||
t.references :course_group, index: true
|
||||
|
||||
t.timestamps
|
||||
|
||||
end
|
||||
|
||||
add_index :course_attendance_groups, [:course_attendance_id, :course_group_id, :course_id], name: "course_group_attendance", unique: true
|
||||
end
|
||||
end
|
@ -0,0 +1,17 @@
|
||||
class CreateCourseMemberAttendances < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :course_member_attendances do |t|
|
||||
t.references :course_member, index: true
|
||||
t.references :user
|
||||
t.references :course, index: true
|
||||
t.references :course_attendance
|
||||
t.references :course_group, index: true
|
||||
t.integer :attendance_mode, default: 0
|
||||
t.integer :attendance_status, default: 0
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :course_member_attendances, [:course_attendance_id, :user_id], unique: true, name: "index_on_user_attendance"
|
||||
end
|
||||
end
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe CourseAttendanceGroup, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe CourseAttendance, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe CourseMemberAttendance, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
Loading…
Reference in new issue