diff --git a/app/controllers/attendances_controller.rb b/app/controllers/attendances_controller.rb
index 6e159cd77..c8287f413 100644
--- a/app/controllers/attendances_controller.rb
+++ b/app/controllers/attendances_controller.rb
@@ -34,7 +34,10 @@ class AttendancesController < ApplicationController
@normal_count = @course.course_member_attendances.where(course_member_id: member&.id, course_attendance_id: attendance_ids, attendance_status: "NORMAL").size
@leave_count = @course.course_member_attendances.where(course_member_id: member&.id, course_attendance_id: attendance_ids, attendance_status: "LEAVE").size
@absence_count = @course.course_member_attendances.where(course_member_id: member&.id, course_attendance_id: attendance_ids, attendance_status: "ABSENCE").size
+ else
+ @attendances = @attendances.where("attendance_date = '#{current_date}' and start_time <= '#{current_end_time}' and end_time > '#{current_end_time}'")
end
+
end
@attendances_count = @attendances.size
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index 3cf564ea5..13be4168b 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -1298,7 +1298,7 @@ class CoursesController < ApplicationController
def left_banner
@user = current_user
@is_teacher = @user_course_identity < Course::ASSISTANT_PROFESSOR
- @course_modules = @course.course_modules.where.not(module_type: 'attendance').where(hidden: 0).includes(first_categories: :children)
+ @course_modules = @course.course_modules.where(hidden: 0).includes(first_categories: :children)
@hidden_modules = @course.course_modules.where(hidden: 1)
@second_category_type = ["shixun_homework", "graduation", "attachment", "board", "course_group", "video", "common_homework", "group_homework"]
end
diff --git a/app/controllers/weapps/attendances_controller.rb b/app/controllers/weapps/attendances_controller.rb
index 9740da15f..90f8c24b6 100644
--- a/app/controllers/weapps/attendances_controller.rb
+++ b/app/controllers/weapps/attendances_controller.rb
@@ -9,8 +9,10 @@ class Weapps::AttendancesController < ApplicationController
def create
ActiveRecord::Base.transaction do
attendance = @course.course_attendances.create!(create_params.merge(user_id: current_user.id))
- unless params[:group_ids].blank? || @course.course_groups.where(id: params[:group_ids]).count == @course.course_groups.count
- group_ids = @course.charge_group_ids(current_user) & params[:group_ids].map(&:to_i)
+ group_ids = params[:group_ids] || []
+ group_ids = group_ids.blank? ? @course.charge_group_ids(current_user) : @course.charge_group_ids(current_user) & params[:group_ids].map(&:to_i)
+ unless group_ids.blank? || @course.course_groups.where(id: group_ids).count == @course.course_groups.count
+ # group_ids = @course.charge_group_ids(current_user) & params[:group_ids].map(&:to_i)
group_ids.each do |group_id|
@course.course_attendance_groups.create!(course_group_id: group_id, course_attendance: attendance)
end
diff --git a/app/jobs/student_join_attendance_record_job.rb b/app/jobs/student_join_attendance_record_job.rb
index 32807bbec..ecc0b46a9 100644
--- a/app/jobs/student_join_attendance_record_job.rb
+++ b/app/jobs/student_join_attendance_record_job.rb
@@ -11,7 +11,7 @@ class StudentJoinAttendanceRecordJob < ApplicationJob
group_ids = member.course_group_id == 0 ? [0] : [member.course_group_id, 0]
current_attendance_ids = course.course_attendances.joins(:course_attendance_groups).where(course_attendance_groups: {course_group_id: group_ids}).
- where("(attendance_date = '#{current_date}' and start_time <= '#{current_end_time}' and end_time > '#{current_end_time}') or (attendance_date > '#{current_date}')").pluck(:id)
+ where("(attendance_date = '#{current_date}' and end_time > '#{current_end_time}') or (attendance_date > '#{current_date}')").pluck(:id)
all_group_attendance_ids = course.course_attendances.joins(:course_attendance_groups).where(course_attendance_groups: {course_group_id: 0}).pluck(:id)
member.course_member_attendances.where.not(course_attendance_id: all_group_attendance_ids+current_attendance_ids).delete_all
diff --git a/app/services/weapps/shixun_search_service.rb b/app/services/weapps/shixun_search_service.rb
index 448bb1992..9fd7cce99 100644
--- a/app/services/weapps/shixun_search_service.rb
+++ b/app/services/weapps/shixun_search_service.rb
@@ -34,11 +34,18 @@ class Weapps::ShixunSearchService < ApplicationService
unless params[:keyword].blank?
keyword = params[:keyword].strip
shixuns = shixuns.joins(:user).
- where("concat(lastname, firstname) like :keyword or shixuns.name like :keyword",
- keyword: "%#{keyword}%", name: "%#{keyword.split(" ").join("%")}%").distinct
+ where("concat(lastname, firstname) like :keyword or shixuns.name like :keyword",
+ keyword: "%#{keyword}%", name: "%#{keyword.split(" ").join("%")}%").distinct
end
- shixuns.order("#{sort_str} #{order_str}")
+ order =
+ if sort_str == "wechat_myshixuns_count"
+ "is_wechat_support desc, myshixuns_count #{order_str}"
+ else
+ "#{sort_str} #{order_str}"
+ end
+
+ shixuns.order(order)
end
private
diff --git a/app/views/weapps/shixun_lists/index.json.jbuilder b/app/views/weapps/shixun_lists/index.json.jbuilder
index fac238f45..10b66fdfa 100644
--- a/app/views/weapps/shixun_lists/index.json.jbuilder
+++ b/app/views/weapps/shixun_lists/index.json.jbuilder
@@ -5,5 +5,6 @@ json.shixun_list @results do |obj|
json.study_count obj.myshixuns_count
json.author_name obj.user.real_name
json.author_img url_to_avatar(obj.user)
+ json.pic url_to_avatar(obj)
end
json.shixuns_count @total_count
\ No newline at end of file
diff --git a/public/react/src/modules/courses/exercise/new/NullChildEditor.js b/public/react/src/modules/courses/exercise/new/NullChildEditor.js
index 5146f05ec..d2f710e55 100644
--- a/public/react/src/modules/courses/exercise/new/NullChildEditor.js
+++ b/public/react/src/modules/courses/exercise/new/NullChildEditor.js
@@ -19,11 +19,11 @@ const { Option } = Select;
class NullChildEditor extends Component{
constructor(props){
super(props);
-
+
this.state = {
}
}
-
+
// toMDMode = (that) => {
// if (this.mdReactObject) {
// let mdReactObject = this.mdReactObject;
@@ -41,7 +41,7 @@ class NullChildEditor extends Component{
render() {
let { question_title, question_score, question_type, question_choices, standard_answers } = this.state;
- let { question_id, index, onAnswerChange, addChildAnswer, toMDMode, exerciseIsPublish,
+ let { question_id, index, onAnswerChange, addChildAnswer, toMDMode, exerciseIsPublish,
answers } = this.props;
// marginTop: '18px'
return(
@@ -57,18 +57,24 @@ class NullChildEditor extends Component{
className={'nullChildEditor'}
placeholder={`请输入参考答案${itemIndex == 0 ?'':'(可选)'}`}
toMDMode={toMDMode} noStorage={true}
- mdID={`answer_${index}${itemIndex}`} height={155}
+ mdID={`answer_${index}${itemIndex}`} height={155}
initValue={item} onChange={(val) => onAnswerChange(index, itemIndex, val)}
>
- {!exerciseIsPublish &&
+ {!exerciseIsPublish &&
{itemIndex != 0 &&
- this.props.deleteChildAnswer(index, itemIndex)}
style={{float: 'right'}}
>
}
+ {itemIndex === 0 &&
+ this.props.deleteChildAnswermain(index, itemIndex)}
+ style={{float: 'right'}}
+ >
+ }
{
addChildAnswer(index)}
diff --git a/public/react/src/modules/courses/exercise/new/NullEditor.js b/public/react/src/modules/courses/exercise/new/NullEditor.js
index dcb310396..9b5dcf9ef 100644
--- a/public/react/src/modules/courses/exercise/new/NullEditor.js
+++ b/public/react/src/modules/courses/exercise/new/NullEditor.js
@@ -38,7 +38,7 @@ class NullEditor extends Component{
answers.answer_text.forEach((item, itemIndex) => {
_standard_answers[index].push(item)
})
-
+
})
}
this.state = {
@@ -53,7 +53,7 @@ class NullEditor extends Component{
this.setState({ is_ordered: e.target.checked})
}
-
+
onSave = () => {
const {question_title, question_score, question_type, question_choices, standard_answers, is_ordered } = this.state;
const { question_id_to_insert_after, question_id } = this.props
@@ -78,8 +78,8 @@ class NullEditor extends Component{
this.props.showNotification('分值:必须大于0'); return;
} else if(!question_score || intScore == NaN) {
this.props.showNotification('分值:不能为空'); return;
- }
-
+ }
+
let isEmpty = false;
standard_answers.forEach((answers, index) => {
@@ -91,8 +91,8 @@ class NullEditor extends Component{
answerArray[index].answer_text.push(item)
if(!item) {
this.refs[`nullChildEditor${index}`].showError(itemIndex)
- // this.props.showNotification(`请先输入第${index+1}个填空的第${itemIndex+1}参考答案。`);
- this.props.showNotification(`答案:不能为空`);
+ // this.props.showNotification(`请先输入第${index+1}个填空的第${itemIndex+1}参考答案。`);
+ this.props.showNotification(`答案:不能为空`);
isEmpty = true;
}
})
@@ -122,7 +122,7 @@ class NullEditor extends Component{
"is_ordered":true
}
}*/
- const Id = this.props.match.params.Id
+ const Id = this.props.match.params.Id
if (question_id) {
const editUrl = this.props.getEditQuestionUrl(question_id);
axios.put(editUrl, {
@@ -146,7 +146,7 @@ class NullEditor extends Component{
});
} else {
const url = this.props.getAddQuestionUrl();
-
+
axios.post(url, {
exercise_bank_id: Id,
question_title,
@@ -165,13 +165,13 @@ class NullEditor extends Component{
.catch(function (error) {
console.log(error);
});
- }
+ }
}
onCancel = () => {
this.props.onEditorCancel()
}
componentDidMount = () => {
-
+
}
on_question_score_change = (e) => {
this.setState({ question_score: e })
@@ -195,13 +195,13 @@ class NullEditor extends Component{
this.mdReactObject.toShowMode()
}
})
-
+
}
-
+
onAnswerChange = (index, itemIndex, val) => {
if (this.state.standard_answers[index]) {
this.setState(
- (prevState) => ({
+ (prevState) => ({
standard_answers : update(prevState.standard_answers
, {[index]: {$splice: [[itemIndex, 1, val]]}}),
})
@@ -217,6 +217,21 @@ class NullEditor extends Component{
)
}
+ deleteChildAnswermain=(index, childIndex)=>{
+ let newstandard_answers=this.state.standard_answers
+
+ this.props.confirm({
+ content: `确认要删除这个参考答案吗?`,
+ onOk: () => {
+ newstandard_answers.splice(index,1)
+ this.setState({
+ standard_answers:newstandard_answers
+ })
+
+ }
+ })
+ }
+
deleteChildAnswer = (index, childIndex) => {
if(!this.state.standard_answers[index][childIndex]) {
this.setState(
@@ -258,16 +273,16 @@ class NullEditor extends Component{
}
this.mdReactObject = that;
}
-
+
render() {
let { question_title, question_score, question_type, question_choices, standard_answers
, is_ordered } = this.state;
let { question_id, index, exerciseIsPublish,
- // question_title,
- // question_type,
+ // question_title,
+ // question_type,
// question_score,
isNew } = this.props;
-
+
// const { getFieldDecorator } = this.props.form;
const isAdmin = this.props.isAdmin()
@@ -302,17 +317,17 @@ class NullEditor extends Component{
(客观题,由系统自动评分,允许手动调分,请设置标准答案 ;支持最多5个空,每空得分按照本题的总分平均计算)
- this.setState({ question_title: val})}
onPlaceholderChange={this.onPlaceholderChange} showNullButton={exerciseIsPublish ? false : true}
ref="titleEditor"
>
-
+
{
standard_answers.map((answers, index) => {
- return
// answer.map((item, itemIndex) => {
// return
@@ -346,16 +362,16 @@ class NullEditor extends Component{
分
-
-
+
+
取消
保存
-
+
-
+
)
}
diff --git a/public/react/src/modules/courses/signin/Signinstatistics/Signinstatistics.js b/public/react/src/modules/courses/signin/Signinstatistics/Signinstatistics.js
index ca7ecace4..b761cf249 100644
--- a/public/react/src/modules/courses/signin/Signinstatistics/Signinstatistics.js
+++ b/public/react/src/modules/courses/signin/Signinstatistics/Signinstatistics.js
@@ -39,18 +39,24 @@ class Signinstatistics extends Component {
response.data.history_attendances.map((item,key)=>{
newlists.push({
month: item.index,
+ name: item.name+" "+item.attendance_date+" "+item.start_time+"-"+item.end_time,
+ // month:item.name,
city:"到课率",
- temperature: (item.normal_rate).toFixed(0)
+ temperature: (item.normal_rate*100).toFixed(0)
})
newlists.push({
month: item.index,
+ name: item.name+" "+item.attendance_date+" "+item.start_time+"-"+item.end_time,
+ // month:item.name,
city: "旷课率",
- temperature: (item.absence_rate).toFixed(0)
+ temperature: (item.absence_rate*100).toFixed(0)
})
newlists.push({
month: item.index,
+ name: item.name+" "+item.attendance_date+" "+item.start_time+"-"+item.end_time,
+ // month:item.name,
city: "请假率",
- temperature: (item.leave_rate).toFixed(0)
+ temperature: (item.leave_rate*100).toFixed(0)
})
})
}
@@ -102,7 +108,16 @@ class Signinstatistics extends Component {
const cols = {
month: {
- range: [0, 1]
+ type: 'linear',
+ nice:[1,10],
+ min:1,
+ minLimit:1,
+ minTickInterval:2
+ },
+ temperature:{
+ type: 'linear',
+ nice:[0,100],
+ minTickInterval:2
}
};
@@ -190,7 +205,7 @@ class Signinstatistics extends Component {
显示最近十次签到
-