diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index 103c33aab..b7aa4b6e4 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -155,9 +155,10 @@ class ChallengesController < ApplicationController def index uid_logger("identifier: #{params}") - - @challenges = @shixun.challenges.fields_for_list - + base_columns = "challenges.id, challenges.subject, challenges.st, challenges.score, challenges.position, + challenges.shixun_id, games.identifier, games.status" + @challenges = @shixun.challenges.joins(:games).where(games: {user_id: current_user.id}) + .select(base_columns) @editable = @shixun.status == 0 # before_action:有判断权限,如果没发布,则肯定是管理人员 @user = current_user @shixun.increment!(:visits) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 8d2c3579a..0a59c379a 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -102,8 +102,14 @@ class CoursesController < ApplicationController end def course_videos - logger.info("########[#{@course}") videos = @course.videos + @video_module = @course.course_modules.find_by(module_type: "video") + if params[:category_id].present? && params[:category_id].to_i != 0 + @category = @video_module&.course_second_categories.find_by(id: params[:category_id]) + tip_exception("子目录id有误") if !@category.present? + videos = videos.where(course_videos: {course_second_category_id: params[:category_id].to_i}) + end + videos = custom_sort(videos, params[:sort_by], params[:sort_direction]) @count = videos.count @videos = paginate videos.includes(user: :user_extension) @@ -124,7 +130,7 @@ class CoursesController < ApplicationController category = @course.course_second_categories.find_by(id: params[:new_category_id]) if params[:new_category_id].to_i == 0 || category.present? - videos = @course.course_videos.where(id: params[:video_ids]) + videos = @course.course_videos.where(video_id: params[:video_ids]) videos.update_all(course_second_category_id: params[:new_category_id]) normal_status(0, "操作成功") diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 8f74f0474..54eb19474 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -182,7 +182,7 @@ class ShixunsController < ApplicationController select m.user_id, u.login, u.lastname, m.updated_at, (select sum(cost_time) from games g where g.myshixun_id = m.id) as time, (select sum(final_score) from games g where g.myshixun_id = m.id) as score - from (users u left join myshixuns m on m.user_id = u.id) where m.shixun_id = #{@shixun.id} and m.status = 1 + from (users u left join myshixuns m on m.user_id = u.id) where u.is_test =0 and m.shixun_id = #{@shixun.id} and m.status = 1 order by score desc, time asc limit 10 " @myshixuns = Myshixun.find_by_sql(sql) diff --git a/app/controllers/weapps/attendances_controller.rb b/app/controllers/weapps/attendances_controller.rb index 3f0eec248..51649150d 100644 --- a/app/controllers/weapps/attendances_controller.rb +++ b/app/controllers/weapps/attendances_controller.rb @@ -58,12 +58,18 @@ class Weapps::AttendancesController < ApplicationController @history_attendances = @course.course_attendances.where(id: history_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). + @current_attendances = @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}'") @history_count = @history_attendances.size + # 当前签到如果存在快捷签到,则直接签到 + quick_attendances = @current_attendances.where(mode: "QUICK") + if quick_attendances.present? + student_direct_attendance quick_attendances, member + end + student_attendance_ids = @history_attendances.pluck(:id) - student_attendance_ids += @current_attendance.present? ? @current_attendance.pluck(:id) : [] + student_attendance_ids += @current_attendances.present? ? @current_attendances.pluck(:id) : [] if student_attendance_ids.uniq.blank? @normal_count = 0 @@ -141,4 +147,8 @@ class Weapps::AttendancesController < ApplicationController def edit_auth tip_exception(403, "") unless @user_course_identity < Course::PROFESSOR || @attendance.user_id == current_user.id end + + def student_direct_attendance quick_attendances, member + + end end \ No newline at end of file diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 8eb608a24..ed76a4b0c 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -80,7 +80,7 @@ module CoursesHelper when "statistics" "/courses/#{course.id}/statistics" when "video" - "/courses/#{course.id}/course_videos/#{mod.id}" + "/courses/#{course.id}/course_videos" end end @@ -98,7 +98,7 @@ module CoursesHelper when "attachment" "/courses/#{course.id}/file/#{category.id}" when "video" - "/courses/#{course.id}/course_videos/#{category.id}" + "/courses/#{course.id}/course_video/#{category.id}" end end diff --git a/app/models/challenge.rb b/app/models/challenge.rb index 70fac990b..d532d6d55 100644 --- a/app/models/challenge.rb +++ b/app/models/challenge.rb @@ -69,12 +69,13 @@ class Challenge < ApplicationRecord end # 开启挑战 - def open_game user_id, shixun - game = self.games.where(user_id: user_id).first - if game.present? - shixun.task_pass || game.status != 3 ? "/tasks/#{game.identifier}" : "" + def open_game + # 这里的identifier,status是关联了games取了games的identifier,status + identifier = self.identifier + if identifier.present? + shixun.task_pass || self.status != 3 ? "/tasks/#{identifier}" : "" else - "/api/shixuns/#{shixun.identifier}/shixun_exec" + self.position == 1 ? "/api/shixuns/#{shixun.identifier}/shixun_exec" : "" end end @@ -92,16 +93,16 @@ class Challenge < ApplicationRecord # end ## 用户关卡状态 0: 不能开启实训; 1:直接开启; 2表示已完成 - def user_tpi_status user_id + def user_tpi_status # todo: 以前没加索引导致相同关卡,同一用户有多个games # 允许跳关则直接开启 - game = games.where(user_id: user_id).take - if game.blank? - position == 1 ? 1 : 0 + identifier = self.identifier + if identifier.blank? + self.position == 1 ? 1 : 0 else - if game.status == 3 + if status == 3 shixun.task_pass ? 1 : 0 - elsif game.status == 2 + elsif status == 2 2 else 1 diff --git a/app/models/course_attendance.rb b/app/models/course_attendance.rb index 1bd96fc29..3b7e07fdf 100644 --- a/app/models/course_attendance.rb +++ b/app/models/course_attendance.rb @@ -1,7 +1,7 @@ class CourseAttendance < ApplicationRecord # status: 0: 未开启,1:已开启,2:已截止 - # mode: 0 两种签到,1 二维码签到,2 数字签到 - enum mode: { ALL: 0, QRCODE: 1, NUMBER: 2 } + # mode: 0 两种签到,1 二维码签到,2 数字签到,3 快捷签到 + enum mode: { ALL: 0, QRCODE: 1, NUMBER: 2, QUICK: 3 } belongs_to :course belongs_to :user diff --git a/app/models/course_member_attendance.rb b/app/models/course_member_attendance.rb index 152bb48b6..b854acfe7 100644 --- a/app/models/course_member_attendance.rb +++ b/app/models/course_member_attendance.rb @@ -1,6 +1,6 @@ class CourseMemberAttendance < ApplicationRecord # attendance_mode :0 初始数据,1 二维码签到,2 数字签到,3 老师签到 - enum attendance_mode: { DEFAULT: 0, QRCODE: 1, NUMBER: 2, TEACHER: 3} + enum attendance_mode: { DEFAULT: 0, QRCODE: 1, NUMBER: 2, QUICK: 3, TEACHER: 4} # attendance_status :1 正常签到,2 请假,0 旷课 enum attendance_status: { NORMAL: 1, LEAVE: 2, ABSENCE: 0 } belongs_to :course_member diff --git a/app/views/challenges/index.json.jbuilder b/app/views/challenges/index.json.jbuilder index c53ab9c58..693f3717f 100644 --- a/app/views/challenges/index.json.jbuilder +++ b/app/views/challenges/index.json.jbuilder @@ -19,7 +19,7 @@ if @challenges.present? json.passed_count challenge.user_passed_count json.playing_count challenge.playing_count json.name_url shixun_challenge_path(challenge, shixun_identifier: @shixun.identifier) - #json.open_game challenge.open_game(@user.id, @shixun) + json.open_game challenge.open_game if @editable json.edit_url edit_shixun_challenge_path(challenge, shixun_identifier: @shixun.identifier) json.delete_url shixun_challenge_path(challenge, shixun_identifier: @shixun.identifier) @@ -27,6 +27,6 @@ if @challenges.present? json.down_url index_down_shixun_challenge_path(challenge, :shixun_identifier => @shixun.identifier) if @shixun.challenges_count != challenge.position end #json.passed challenge.has_passed?(@user.id) - json.status challenge.user_tpi_status @user.id + json.status challenge.user_tpi_status end end diff --git a/app/views/courses/course_videos.json.jbuilder b/app/views/courses/course_videos.json.jbuilder index 807ff92bb..db4f4006c 100644 --- a/app/views/courses/course_videos.json.jbuilder +++ b/app/views/courses/course_videos.json.jbuilder @@ -1,3 +1,8 @@ json.count @count json.videos @videos, partial: 'users/videos/video', as: :video -json.course_id @course.id \ No newline at end of file +json.course_id @course.id +if @category.present? + json.category_id @category.id + json.category_name @category.name +end +json.course_module_id @video_module&.id \ No newline at end of file diff --git a/app/views/weapps/attendances/index.json.jbuilder b/app/views/weapps/attendances/index.json.jbuilder index 34317d08d..da8be3c8d 100644 --- a/app/views/weapps/attendances/index.json.jbuilder +++ b/app/views/weapps/attendances/index.json.jbuilder @@ -1,15 +1,17 @@ json.current_attendance @current_attendance do |attendance| - json.(attendance, :id, :normal_count, :all_count) - json.attendance_date attendance.attendance_date.strftime("%Y/%m/%d") + json.(attendance, :id, :name, :normal_count, :all_count) + 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") end all_normal_rate = [] all_absence_rate = [] +all_leave_rate = [] json.history_attendances @history_attendances.each_with_index.to_a do |attendance, index| normal_count = history_member_count(@all_member_attendances, "NORMAL", attendance.id) absence_count = history_member_count(@all_member_attendances, "ABSENCE", attendance.id) + leave_count = history_member_count(@all_member_attendances, "LEAVE", attendance.id) all_count = @all_member_attendances.select{|member_attendance| member_attendance.course_attendance_id == attendance.id}.size json.index index + 1 @@ -17,8 +19,11 @@ json.history_attendances @history_attendances.each_with_index.to_a do |attendanc all_normal_rate << cal_rate(normal_count, all_count) json.absence_rate cal_rate(absence_count, all_count) all_absence_rate << cal_rate(absence_count, all_count) + json.leave_rate cal_rate(leave_count, all_count) + all_leave_rate << cal_rate(leave_count, all_count) end json.all_history_count @all_history_count json.avg_normal_rate @all_history_count == 0 ? 0 : all_normal_rate.sum / @all_history_count json.avg_absence_rate @all_history_count == 0 ? 0 : all_absence_rate.sum / @all_history_count +json.avg_leave_rate @all_history_count == 0 ? 0 : all_leave_rate.sum / @all_history_count diff --git a/app/views/weapps/attendances/show.json.jbuilder b/app/views/weapps/attendances/show.json.jbuilder index 1eb73347e..b3f13ca60 100644 --- a/app/views/weapps/attendances/show.json.jbuilder +++ b/app/views/weapps/attendances/show.json.jbuilder @@ -5,7 +5,8 @@ json.all_count @all_count json.code @attendance.attendance_code json.mode @attendance.mode json.edit_auth @user_course_identity < Course::PROFESSOR || @attendance.user_id == User.current.id -json.attendance_date @attendance.attendance_date.strftime("%Y/%m/%d") +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") diff --git a/app/views/weapps/attendances/student_attendances.json.jbuilder b/app/views/weapps/attendances/student_attendances.json.jbuilder index c2b9fca12..f0ee4c8f8 100644 --- a/app/views/weapps/attendances/student_attendances.json.jbuilder +++ b/app/views/weapps/attendances/student_attendances.json.jbuilder @@ -1,4 +1,4 @@ -json.current_attendance @current_attendance do |attendance| +json.current_attendance @current_attendances do |attendance| json.partial! 'student_attendance', locals: {attendance: attendance} end diff --git a/db/migrate/20200309071103_migrate_member_attendance_mode.rb b/db/migrate/20200309071103_migrate_member_attendance_mode.rb new file mode 100644 index 000000000..41f81444a --- /dev/null +++ b/db/migrate/20200309071103_migrate_member_attendance_mode.rb @@ -0,0 +1,5 @@ +class MigrateMemberAttendanceMode < ActiveRecord::Migration[5.2] + def change + CourseMemberAttendance.where(attendance_mode: 3).update_all(attendance_mode: 4) + end +end diff --git a/public/images/educoder/xcx/fenxiangs.png b/public/images/educoder/xcx/fenxiangs.png new file mode 100755 index 000000000..f5b170bed Binary files /dev/null and b/public/images/educoder/xcx/fenxiangs.png differ diff --git a/public/images/educoder/xcx/xuesqiandao.png b/public/images/educoder/xcx/xuesqiandao.png new file mode 100755 index 000000000..7124615fd Binary files /dev/null and b/public/images/educoder/xcx/xuesqiandao.png differ diff --git a/public/react/src/modules/question/Question.js b/public/react/src/modules/question/Question.js index 772a75fb1..87d05f71a 100644 --- a/public/react/src/modules/question/Question.js +++ b/public/react/src/modules/question/Question.js @@ -742,9 +742,6 @@ class Question extends Component { } // 撤销 getitem_basketss=(id)=>{ - this.setState({ - - }) if(Undoclickable===true){ Undoclickable=false; //选用题型可以上传单个 或者多个题型 diff --git a/public/react/src/modules/question/component/Contentpart.js b/public/react/src/modules/question/component/Contentpart.js index f4fba7d5f..e3f5259e5 100644 --- a/public/react/src/modules/question/component/Contentpart.js +++ b/public/react/src/modules/question/component/Contentpart.js @@ -232,39 +232,6 @@ class Contentpart extends Component { } - const content = ( -
-

this.props.setitem_types(null)}>全部

-

-

this.props.setitem_types("SINGLE")}>单选题

-

-

this.props.setitem_types("MULTIPLE")}>多选题

-

-

this.props.setitem_types("JUDGMENT")}>判断题

-

-

this.props.setitem_types("PROGRAM")}>编程题

-

- -
- ); - const contents = ( -
-

this.props.setoj_status(null)}>全部

-

-

this.props.setoj_status(0)}>未发布

-

-

this.props.setoj_status(1)}>已发布

-

-
- ); - - // console.log("Contentpart.js"); // console.log(this.props.current_user.professional_certification); @@ -381,22 +348,6 @@ class Contentpart extends Component { :"" } - {item_type==="PROGRAM"? - defaultActiveKey===0||defaultActiveKey==="0"? - trigger.parentNode} placement="bottom" trigger="hover" content={contents} onVisibleChange={()=>this.props.handleVisibleChange(true)}> -
- -
- 全部 -
- -
-
- : - "":"" - } - - { this.props.Isitapopup&&this.props.Isitapopup==="true"? { return ( { items.item_type==="PROGRAM"? - this.seturls(`/problems/${items.program_attr.identifier}/edit`)} className="ml10 flex1 mt2"> -
-
+ ( + this.props.defaultActiveKeys&&this.props.defaultActiveKeys==="0"? + this.seturls(`/problems/${items.program_attr.identifier}/edit`)} className="ml10 flex1 mt2 xiaoshou"> +
+
+ : +

+

+

+ ) + :
diff --git a/public/react/src/modules/question/component/QuestionModal.js b/public/react/src/modules/question/component/QuestionModal.js index de7614f37..87338faa7 100644 --- a/public/react/src/modules/question/component/QuestionModal.js +++ b/public/react/src/modules/question/component/QuestionModal.js @@ -28,11 +28,21 @@ class QuestionModal extends Component { width="442px" >
-

{this.props.titilesm}

-

{this.props.titiless}

+ {this.props.titilesm? +

{this.props.titilesm}

+ + : + "" + } + { + this.props.titiless? +

{this.props.titiless}

+ : + "" + }
this.props.modalCancel()}>取消 - this.props.setDownload()}>确定 + this.props.setDownload()}>{this.props.boolok?this.props.boolok:"确定"}
diff --git a/public/react/src/modules/testpaper/Paperlibraryseeid.js b/public/react/src/modules/testpaper/Paperlibraryseeid.js index d81a0afa7..ce529c05e 100644 --- a/public/react/src/modules/testpaper/Paperlibraryseeid.js +++ b/public/react/src/modules/testpaper/Paperlibraryseeid.js @@ -19,6 +19,7 @@ import '../tpm/newshixuns/css/Newshixuns.css'; import Bottomsubmit from "../../modules/modals/Bottomsubmit"; import Seeoagertit from "./component/Seeoagertit"; import Paperlibraryseeid_item from './component/Paperlibraryseeid_item'; +import QuestionModal from "../question/component/QuestionModal"; //人工组卷预览 class Paperlibraryseeid extends Component { constructor(props) { @@ -27,8 +28,10 @@ class Paperlibraryseeid extends Component { this.state = { paperlibrartdata:[], defaultActiveKey:"0", - - + modalsType:false, + titilesm:"", + titiless:"", + boolok:"知道了" } @@ -91,7 +94,11 @@ class Paperlibraryseeid extends Component { } preservation = () => { //保存试卷 - + this.setState({ + modalsType: true, + titilesm: "功能正在内测中,敬请期待", + titiless: "", + }) @@ -109,13 +116,34 @@ class Paperlibraryseeid extends Component { getcontentMdRef = (Ref) => { this.contentMdRef = Ref; } + + modalCancel =()=>{ + this.setState({ + modalsType: false, + }) + + } + + setDownload =()=>{ + this.setState({ + modalsType: false, + }) + + } + render() { - let {paperlibrartdata,defaultActiveKey} = this.state; + let {paperlibrartdata,defaultActiveKey,titilesm,titiless,boolok,modalsType} = this.state; const params = this.props && this.props.match && this.props.match.params; // ////console.log(params); let urlsysl=`/paperlibrary?defaultActiveKey=${defaultActiveKey}`; return (
+ { + modalsType===true? + this.modalCancel()} + setDownload={() => this.setDownload()}> + :"" + }
diff --git a/public/react/src/modules/tpm/shixuns/shixun-search-bar/index.jsx b/public/react/src/modules/tpm/shixuns/shixun-search-bar/index.jsx index 29a3b8485..c936de66d 100644 --- a/public/react/src/modules/tpm/shixuns/shixun-search-bar/index.jsx +++ b/public/react/src/modules/tpm/shixuns/shixun-search-bar/index.jsx @@ -91,7 +91,7 @@ export default ({ StatusEnquiry, allUpdatashixunlist, Updatasearchlist }) => {
方向:
- 全部 +
  • 全部
  • { navs.map((item, key) => { return (