courseware
杨树林 5 years ago
commit d21e97541f

@ -7,13 +7,13 @@ class Admins::CoursesController < Admins::BaseController
courses = Admins::CourseQuery.call(params)
@ended_courses = courses.where(is_end: 1).size
@processed_courses = courses.where(is_end: 0).size
@courses = paginate courses.includes(:school, :students, :attachments, :homework_commons, teacher: :user_extension)
@courses = paginate courses.includes(:school, :students, :teacher_course_members, :informs, :course_videos, :attachments, :homework_commons, teacher: :user_extension)
respond_to do |format|
format.js
format.html
format.xlsx do
@courses = courses.includes(:school, :students, :attachments, :homework_commons, :course_acts, teacher: :user_extension)
@courses = courses.includes(:school, :students, :teacher_course_members, :informs, :course_videos, :attachments, :homework_commons, :course_activities, teacher: [user_extension: :department])
filename = "课堂列表_#{Time.current.strftime('%Y%m%d%H%M%S')}.xlsx"
render xlsx: 'index', filename: filename
end

@ -406,6 +406,15 @@ class Course < ApplicationRecord
homework_commons.select{|homework| homework.homework_type == type}.size
end
# 课堂作业数
def published_course_homework_count type
homework_commons.select{|homework| homework.homework_type == type && homework.publish_time.present? && homework.publish_time <= Time.now}.size
end
def student_works_count
StudentWork.joins(:homework_common).where(homework_commons: {course_id: id}).where("work_status > 0").size
end
private
#创建课程后,给该用户发送消息

@ -3,22 +3,28 @@ wb = xlsx_package.workbook
wb.styles do |s|
blue_cell = s.add_style :bg_color => "FAEBDC", :sz => 10,:height => 25,:b => true, :border => { :style => :thin, :color =>"000000" },:alignment => {wrap_text: true,:horizontal => :center,:vertical => :center}
wb.add_worksheet(name: "课堂列表") do |sheet|
sheet.add_row %w(ID 课堂名称 成员 资源 普通作业 分组作业 实训作业 试卷 评测次数 私有 状态 单位 创建者 创建时间 动态时间), :height => 25,:style => blue_cell
sheet.add_row %w(ID 课堂名称 老师 学生 资源 公告 视频 普通作业 分组作业 实训作业 实训作业已发布数 作品数 试卷 评测次数 私有 状态 单位 部门 创建者 创建时间 动态时间), :height => 25,:style => blue_cell
@courses.each do |course|
data = [
course.id,
course.name,
course.course_members_count,
course.teacher_course_members.size,
course.students.size,
get_attachment_count(course, 0),
course.course_homework_count(1),
course.course_homework_count(3),
course.course_homework_count(4),
course.informs.size,
course.course_videos.size,
course.course_homework_count("normal"),
course.course_homework_count("group"),
course.course_homework_count("practice"),
course.published_course_homework_count("practice"),
course.student_works_count,
course.exercises_count,
course.evaluate_count,
course.is_public == 1 ? "--" : "√",
course.is_end ? "已结束" : "正在进行",
course.school&.name,
course.teacher&.department_name,
course.teacher&.real_name,
course.created_at&.strftime('%Y-%m-%d %H:%M'),
course.max_activity_time ? course.max_activity_time&.strftime('%Y-%m-%d %H:%M') : "--"

@ -3,18 +3,22 @@
<tr>
<th width="4%">序号</th>
<th width="4%">ID</th>
<th width="10%" class="text-left">课堂名称</th>
<th width="5%">成员</th>
<th width="8%" class="text-left">课堂名称</th>
<th width="4%">老师</th>
<th width="4%">学生</th>
<th width="4%">资源</th>
<th width="4%">公告</th>
<th width="4%">视频</th>
<th width="4%">普通作业</th>
<th width="4%">分组作业</th>
<th width="4%">实训作业</th>
<th width="4%">作品数</th>
<th width="4%">试卷</th>
<th width="6%">评测次数</th>
<th width="4%">私有</th>
<th width="6%">状态</th>
<th width="10%">单位</th>
<th width="7%">创建者</th>
<th width="4%">状态</th>
<th width="8%">单位</th>
<th width="6%">创建者</th>
<th width="10%"><%= sort_tag('创建时间', name: 'created_at', path: admins_courses_path) %></th>
<th width="4%">首页</th>
<th width="5%">邮件通知</th>

@ -3,11 +3,15 @@
<td class="text-left">
<%= link_to(course.name, "/classrooms/#{course.id}", target: '_blank') %>
</td>
<td><%= course.course_members_count %></td>
<td><%= course.teacher_course_members.size %></td>
<td><%= course.students.size %></td>
<td><%= get_attachment_count(course, 0) %></td>
<td><%= course.informs.size %></td>
<td><%= course.course_videos.size %></td>
<td><%= course.course_homework_count("normal") %></td>
<td><%= course.course_homework_count("group") %></td>
<td><%= course.course_homework_count("practice") %></td>
<td><%= course.student_works_count %></td>
<td><%= course.exercises_count %></td>
<td><%= course.evaluate_count %></td>
<td><%= course.is_public == 1 ? "--" : "√" %></td>

@ -30,6 +30,7 @@ json.course_modules @course_modules.each do |mod|
json.third_category category.children do |child|
json.partial! "category_info", category: child
json.parent_id child.parent_id
end
end
end

@ -2519,7 +2519,6 @@ class Listofworksstudentone extends Component {
axios.get(url).then((response) => {
if (response) {
if (response.data.status === 0) {
setTimeout(() => {
this.props.showNotification(`${response.data.message}`);
// var homeworkid = this.props.match.params.homeworkid;
this.Getalistofworks(homeworkid, false);
@ -2529,12 +2528,14 @@ class Listofworksstudentone extends Component {
} catch (e) {
}
}, 2500);
}
}
// this.Getalistofworkstwo("", "", "", "", 1, 20);
}).catch((error) => {
console.log(error)
this.setState({
computeTimetype:true
})
});
}
@ -3364,10 +3365,6 @@ class Listofworksstudentone extends Component {
axios.get(url).then((response) => {
if (response) {
if (response.data.status === 0) {
// if(response.data.message!==undefined){
// return;
// }
setTimeout(() => {
this.setState({
loadingstate: true
})
@ -3382,13 +3379,13 @@ class Listofworksstudentone extends Component {
} catch (e) {
}
}, 2500);
}
// this.props.history.replace( matchurl );
}
}).catch((error) => {
console.log(error)
this.setState({
computeTimetype:true
})
});
};
@ -3672,27 +3669,9 @@ class Listofworksstudentone extends Component {
<li className="clearfix mt10">
<div className="fr search-newysl" style={{marginBottom: '1px'}}>
{/*{course_is_end===true?"":<span>*/}
{/*{teacherdata&&teacherdata.update_score===true&&computeTimetype===true?*/}
{/* (this.props.isNotMember()===false?<div className={"computeTime font-16"} onClick={this.setComputeTimet}>*/}
{/* 查看最新成绩*/}
{/* </div>:""):*/}
{/* teacherdata&&teacherdata.homework_status!==undefined&&teacherdata.homework_status[0]=== "未发布"? "":*/}
{/* (this.props.isNotMember()===false?<div className={"computeTimes font-16"}>*/}
{/* 查看最新成绩*/}
{/* </div>:"")*/}
{/*}*/}
{/*</span>}*/}
<span className="search-newyslw fr ml20">
{/*<Search*/}
{/* placeholder="请输入姓名或学号搜索"*/}
{/* id="subject_search_input"*/}
{/* autoComplete="off"*/}
{/* value={searchtext}*/}
{/* // onKeyUp={(e) => this.onSearchKeywordKeyUpt(e)}*/}
{/* onInput={this.inputSearchValuest}*/}
{/* onSearch={this.searchValuest}*/}
{/*></Search>*/}
{publicSearchs("请输入姓名或学号搜索",this.searchValuest,this.inputSearchValuest,this.inputSearchValuest)}
</span>
</div>
@ -3993,27 +3972,7 @@ class Listofworksstudentone extends Component {
<div className="fr">
{/*<span className="fl mr10 color-grey-6 ">计算成绩时间:{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}</span>*/}
{/* { course_is_end===true?"":teacherdata&&teacherdata.task_operation[0]==="开启挑战"?"":<span>*/}
{/* {computeTimetype===true?*/}
{/* (this.props.isNotMember()===false?*/}
{/* (*/}
{/* teacherdata&&teacherdata.update_score===true?*/}
{/* <div className={"computeTime font-16"} onClick={this.setComputeTime}>*/}
{/* 查看最新成绩*/}
{/* </div>*/}
{/* :""*/}
{/* )*/}
{/* :"")*/}
{/* :*/}
{/* (teacherdata&&teacherdata.homework_status!==undefined&&teacherdata.homework_status[0]=== "未发布"? "":*/}
{/* this.props.isNotMember()===false?*/}
{/* <div className={"computeTimes font-16"}>*/}
{/* 查看最新成绩*/}
{/* </div>*/}
{/* :"")*/}
{/* }*/}
{/*</span>}*/}
</div>
@ -4238,24 +4197,7 @@ class Listofworksstudentone extends Component {
</style>
<div className="fr">
{/*<span className="fl mr10 color-grey-6 ">计算成绩时间:{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}</span>*/}
{/* { course_is_end===true?"":teacherdata&&teacherdata.task_operation&&teacherdata.task_operation[0]==="开启挑战"?"":<span>*/}
{/* {computeTimetype===true?*/}
{/* (this.props.isNotMember()===false?*/}
{/* (*/}
{/* teacherdata&&teacherdata.update_score===true?*/}
{/* <div className={"computeTime font-16"} onClick={this.setComputeTime}>*/}
{/* 查看最新成绩*/}
{/* </div>:""*/}
{/* )*/}
{/* :""):*/}
{/* teacherdata&&teacherdata.homework_status!==undefined&&teacherdata.homework_status[0]=== "未发布"? "":*/}
{/* (this.props.isNotMember()===false?<div className={"computeTimes font-16"}>*/}
{/* 查看最新成绩*/}
{/* </div>:"")*/}
{/* }*/}
{/*</span>}*/}
</div>
</div>
</div>

Loading…
Cancel
Save