diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index df3e9c96e..76ffe23d4 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -112,6 +112,8 @@ class ApplicationController < ActionController::Base "验证码发送次数超过频率" when 43 "一天内同一手机号发送次数超过限制" + when 53 + "手机号接收超过频率限制" end end diff --git a/app/controllers/weapps/code_sessions_controller.rb b/app/controllers/weapps/code_sessions_controller.rb index 687605fc4..a99a048e2 100644 --- a/app/controllers/weapps/code_sessions_controller.rb +++ b/app/controllers/weapps/code_sessions_controller.rb @@ -1,8 +1,10 @@ class Weapps::CodeSessionsController < Weapps::BaseController def create - logged = false return render_error('code不能为空') if params[:code].blank? + reset_session + logged = false + result = Wechat::Weapp.jscode2session(params[:code]) # 能根据 code 拿到 unionid diff --git a/app/libs/util.rb b/app/libs/util.rb index 84f14a6c0..38b5c9af5 100644 --- a/app/libs/util.rb +++ b/app/libs/util.rb @@ -65,4 +65,19 @@ module Util else "#{str[0..2]}***#{str[-3..-1]}" end end + + def display_cost_time(time) + time = time.to_i + return if time.zero? || time < 60 + + day = time / (24 * 60 * 60) + hour = (time % (24 * 60 * 60)) / (60 * 60) + minute = (time % (60 * 60)) / 60 + + str = '' + str += "#{day}天" unless day.zero? + str += "#{hour}小时" unless hour.zero? + str += "#{minute}分" unless minute.zero? + str + end end \ No newline at end of file diff --git a/app/queries/admins/user_statistic_query.rb b/app/queries/admins/user_statistic_query.rb index d1811e5ab..d05656b3e 100644 --- a/app/queries/admins/user_statistic_query.rb +++ b/app/queries/admins/user_statistic_query.rb @@ -50,6 +50,8 @@ class Admins::UserStatisticQuery < ApplicationQuery finish_myshixun_map = finish_myshixun.group(:user_id).count study_challenge_map = study_challenge.group(:user_id).count finish_challenge_map = finish_challenge.group(:user_id).count + evaluate_count_map = study_challenge.group(:user_id).sum(:evaluate_count) + cost_time_map = study_challenge.group(:user_id).sum(:cost_time) users.each do |user| user._extra_data = { @@ -57,6 +59,8 @@ class Admins::UserStatisticQuery < ApplicationQuery finish_shixun_count: finish_myshixun_map.fetch(user.id, 0), study_challenge_count: study_challenge_map.fetch(user.id, 0), finish_challenge_count: finish_challenge_map.fetch(user.id, 0), + evaluate_count: evaluate_count_map.fetch(user.id, 0), + cost_time: cost_time_map.fetch(user.id, 0), } end diff --git a/app/views/admins/myshixuns/shared/_list.html.erb b/app/views/admins/myshixuns/shared/_list.html.erb index 78e42d58b..89ad535c5 100644 --- a/app/views/admins/myshixuns/shared/_list.html.erb +++ b/app/views/admins/myshixuns/shared/_list.html.erb @@ -17,14 +17,10 @@ <% myshixuns.each do |myshixun| %> <%= myshixun.id %> - + <%= myshixun.identifier %> + <% current_task = myshixun.last_executable_task || myshixun.last_task %> <%= link_to "/myshixuns/#{myshixun.identifier}/stages/#{current_task.identifier}", target: '_blank' do %> - <%= myshixun.identifier %> - <% end %> - - - <%= link_to "/shixuns/#{myshixun.shixun.identifier}", target: '_blank' do %> <%= overflow_hidden_span myshixun.shixun.name, width: 280 %> <% end %> diff --git a/app/views/admins/user_statistics/export.xlsx.axlsx b/app/views/admins/user_statistics/export.xlsx.axlsx index b66e62a99..1511b6ea3 100644 --- a/app/views/admins/user_statistics/export.xlsx.axlsx +++ b/app/views/admins/user_statistics/export.xlsx.axlsx @@ -1,6 +1,6 @@ wb = xlsx_package.workbook wb.add_worksheet(name: '用户实训情况') do |sheet| - sheet.add_row %w(姓名 单位部门 学习关卡数 完成关卡数 学习实训数 完成实训数) + sheet.add_row %w(姓名 单位部门 学习关卡数 完成关卡数 学习实训数 完成实训数 评测次数 实战时间) @users.each do |user| data = [ @@ -9,7 +9,9 @@ wb.add_worksheet(name: '用户实训情况') do |sheet| user.display_extra_data(:study_challenge_count), user.display_extra_data(:finish_challenge_count), user.display_extra_data(:study_shixun_count), - user.display_extra_data(:finish_shixun_count) + user.display_extra_data(:finish_shixun_count), + user.display_extra_data(:evaluate_count), + Util.display_cost_time(user.display_extra_data(:cost_time)), ] sheet.add_row(data) end diff --git a/app/views/admins/user_statistics/shared/_list.html.erb b/app/views/admins/user_statistics/shared/_list.html.erb index 1e1b14ea3..44076812d 100644 --- a/app/views/admins/user_statistics/shared/_list.html.erb +++ b/app/views/admins/user_statistics/shared/_list.html.erb @@ -2,11 +2,13 @@ 姓名 - 单位部门 - <%= sort_tag('学习关卡数', name: 'study_challenge_count', path: admins_user_statistics_path) %> - <%= sort_tag('完成关卡数', name: 'finish_challenge_count', path: admins_user_statistics_path) %> - <%= sort_tag('学习实训数', name: 'study_shixun_count', path: admins_user_statistics_path) %> - <%= sort_tag('完成实训数', name: 'finish_shixun_count', path: admins_user_statistics_path) %> + 单位部门 + <%= sort_tag('学习关卡数', name: 'study_challenge_count', path: admins_user_statistics_path) %> + <%= sort_tag('完成关卡数', name: 'finish_challenge_count', path: admins_user_statistics_path) %> + <%= sort_tag('学习实训数', name: 'study_shixun_count', path: admins_user_statistics_path) %> + <%= sort_tag('完成实训数', name: 'finish_shixun_count', path: admins_user_statistics_path) %> + 评测次数 + 实战时间 @@ -23,6 +25,8 @@ <%= user.display_extra_data(:finish_challenge_count) %> <%= user.display_extra_data(:study_shixun_count) %> <%= user.display_extra_data(:finish_shixun_count) %> + <%= user.display_extra_data(:evaluate_count) %> + <%= Util.display_cost_time(user.display_extra_data(:cost_time)) || '--' %> <% end %> <% else %> diff --git a/app/views/admins/weapp_adverts/shared/_add_weapp_advert_modal.html.erb b/app/views/admins/weapp_adverts/shared/_add_weapp_advert_modal.html.erb index 9909084b8..3937054b5 100644 --- a/app/views/admins/weapp_adverts/shared/_add_weapp_advert_modal.html.erb +++ b/app/views/admins/weapp_adverts/shared/_add_weapp_advert_modal.html.erb @@ -21,7 +21,7 @@ - <%= f.input :link, as: :url, label: '跳转地址', placeholder: '请输入跳转地址' %> + <%= f.input :link, label: '跳转地址', placeholder: '请输入跳转地址' %>
<% end %> diff --git a/app/views/admins/weapp_carousels/shared/_add_weapp_carousel_modal.html.erb b/app/views/admins/weapp_carousels/shared/_add_weapp_carousel_modal.html.erb index 767ae61ae..123ce4a62 100644 --- a/app/views/admins/weapp_carousels/shared/_add_weapp_carousel_modal.html.erb +++ b/app/views/admins/weapp_carousels/shared/_add_weapp_carousel_modal.html.erb @@ -21,7 +21,7 @@ - <%= f.input :link, as: :url, label: '跳转地址', placeholder: '请输入跳转地址' %> + <%= f.input :link, label: '跳转地址', placeholder: '请输入跳转地址' %>
<% end %> diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js index 7f18089ae..9d3d94561 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js @@ -987,6 +987,7 @@ class Listofworksstudentone extends Component {
已通过{record.completion}关,共{this.state.challenges_count}关
+
完成任务评测之前查看了参考答案:{record.view_answer_count}关
}> {record.completion+"/"+this.state.challenges_count}
@@ -1100,6 +1101,7 @@ class Listofworksstudentone extends Component { :
{record.user_name}{record.user_login}
+
完成任务评测之前查看了参考答案:{record.view_answer_count}关
{record.levelscore === "--"?关卡得分:0分 :关卡得分:{record.levelscore}分}
{record.efficiencyscore === "--"?效率评分:0分 :效率评分:{record.efficiencyscore}分}
{record.late_penalty === "--"?迟交扣分:0分 :迟交扣分:{record.late_penalty}分}
@@ -1293,6 +1295,7 @@ class Listofworksstudentone extends Component {
已通过{record.completion}关,共{this.state.challenges_count}关
+
完成任务评测之前查看了参考答案:{record.view_answer_count}关
}> {record.completion+"/"+this.state.challenges_count}
@@ -1406,6 +1409,7 @@ class Listofworksstudentone extends Component { :
{record.user_name}{record.user_login}
+
完成任务评测之前查看了参考答案:{record.view_answer_count}关
{record.levelscore === "--"?关卡得分:0分 :关卡得分:{record.levelscore}分}
{record.efficiencyscore === "--"?效率评分:0分 :效率评分:{record.efficiencyscore}分}
{record.late_penalty === "--"?迟交扣分:0分 :迟交扣分:{record.late_penalty}分}
@@ -1795,6 +1799,7 @@ class Listofworksstudentone extends Component { updatetime: timedata === "Invalid date" ? "--" : timedata, completion: teacherdata.complete_count === null ? "0" :teacherdata.complete_count === undefined ? "0": teacherdata.complete_count, levelscore: teacherdata.final_score, + view_answer_count: teacherdata.view_answer_count, efficiencyscore: teacherdata.eff_score, finalscore: teacherdata.work_score, operating: "查看", @@ -1838,6 +1843,7 @@ class Listofworksstudentone extends Component { levelscore: student_works[i].final_score, efficiencyscore: student_works[i].eff_score==="0.0"?"--":student_works[i].eff_score==="0"?"--":student_works[i].eff_score, finalscore:student_works[i].work_score, + view_answer_count: student_works[i].view_answer_count, operating: "查看", late_penalty: student_works[i].late_penalty=== null?"0":student_works[i].late_penalty === undefined?"0":student_works[i].late_penalty, ultimate_score:student_works[i].ultimate_score, @@ -1979,6 +1985,7 @@ class Listofworksstudentone extends Component { completion: teacherdata.complete_count === null ? "0" :teacherdata.complete_count === undefined ? "0": teacherdata.complete_count, levelscore: teacherdata.final_score, efficiencyscore: teacherdata.eff_score, + view_answer_count: teacherdata.view_answer_count, finalscore: teacherdata.work_score, operating: "查看", late_penalty: teacherdata.late_penalty=== null?"0":teacherdata.late_penalty === undefined?"0":teacherdata.late_penalty, @@ -2327,6 +2334,7 @@ class Listofworksstudentone extends Component { levelscore: student_works[i].final_score, efficiencyscore: student_works[i].eff_score==="0.0"?"--":student_works[i].eff_score==="0"?"--":student_works[i].eff_score, finalscore: student_works[i].work_score, + view_answer_count: student_works[i].view_answer_count, operating: "查看", late_penalty: student_works[i].late_penalty=== null?"0":student_works[i].late_penalty === undefined?"0":student_works[i].late_penalty, ultimate_score:student_works[i].ultimate_score, diff --git a/public/react/src/modules/courses/shixunHomework/shixunreport/OfficialAcademicTranscript.js b/public/react/src/modules/courses/shixunHomework/shixunreport/OfficialAcademicTranscript.js index be99c7035..d115eef45 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunreport/OfficialAcademicTranscript.js +++ b/public/react/src/modules/courses/shixunHomework/shixunreport/OfficialAcademicTranscript.js @@ -1,95 +1,97 @@ import React, {Component} from "react"; import {WordsBtn} from 'educoder'; -import {Table,InputNumber,Tooltip} from "antd"; -import {Link,Switch,Route,Redirect} from 'react-router-dom'; +import {Table, InputNumber, Tooltip} from "antd"; +import {Link, Switch, Route, Redirect} from 'react-router-dom'; import axios from 'axios'; + class OfficialAcademicTranscript extends Component { constructor(props) { super(props); this.state = { - loadingstate:true, - datas:undefined, - customsids:undefined + loadingstate: true, + datas: undefined, + customsids: undefined } } componentDidMount() { } - myjumptopic=(e)=>{ + + myjumptopic = (e) => { console.log("获取到值"); console.log(e); this.props.jumptopic(e); } - editgame_scores=(e,id,maxsum)=>{ - let{datas}=this.state; - let newdatas=datas; - let score=e.target.value; + editgame_scores = (e, id, maxsum) => { + let {datas} = this.state; + let newdatas = datas; + let score = e.target.value; - if(score!=null&&score!=undefined&&score!=""){ - if(score<0){ + if (score != null && score != undefined && score != "") { + if (score < 0) { this.props.showNotification("不能小于0"); this.setState({ - customsids:id + customsids: id }) - }else if(score>maxsum){ + } else if (score > maxsum) { this.props.showNotification(`不能大于关卡分值${maxsum}`); this.setState({ - customsids:id + customsids: id }) - }else{ - let work_id=this.props.data.work_id; - let url=`/student_works/${work_id}/adjust_review_score.json` - axios.post(url,{ - type:"report", - score:score, - challenge_id:id - }).then((result)=>{ - if(result.data.status===0){ + } else { + let work_id = this.props.data.work_id; + let url = `/student_works/${work_id}/adjust_review_score.json` + axios.post(url, { + type: "report", + score: score, + challenge_id: id + }).then((result) => { + if (result.data.status === 0) { // this.props.getdatalist() this.props.showNotification(result.data.message); - this.props.setupdalist(result.data.challenge_score,result.data.overall_appraisal,result.data.work_score) - newdatas.map((item,key)=>{ - if(item.challenge_id.id===id){ - item.game_scores.game_score=score + this.props.setupdalist(result.data.challenge_score, result.data.overall_appraisal, result.data.work_score) + newdatas.map((item, key) => { + if (item.challenge_id.id === id) { + item.game_scores.game_score = score } }) this.setState({ - datas:newdatas, - customsids:undefined + datas: newdatas, + customsids: undefined }) - }else{ + } else { this.props.showNotification(result.data.message); } - }).catch((error)=>{ + }).catch((error) => { }) } - }else{ + } else { this.props.showNotification("调分为空将不会修改之前的分数"); } } render() { - let {customsids}=this.state; - let {data}=this.props; + let {customsids} = this.state; + let {data} = this.props; - let datas=[]; - if(data!=undefined){ - data.stage_list===undefined?"":data.stage_list.forEach((item,key)=>{ + let datas = []; + if (data != undefined) { + data.stage_list === undefined ? "" : data.stage_list.forEach((item, key) => { datas.push({ - customs: key+1, - taskname:{name:item.name,complete_status:item.complete_status}, - openingtime:item.open_time, + customs: key + 1, + taskname: {name: item.name, complete_status: item.complete_status}, + openingtime: item.open_time, evaluating: item.evaluate_count, - finishtime:item.finished_time, - elapsedtime:item.time_consuming, - empvalue:{myself:item.myself_experience,experience:item.experience}, - game_scores:{game_score:item.game_score,game_score_full:item.game_score_full}, - challenge_id:{id:item.challenge_id}, + finishtime: item.finished_time, + elapsedtime: item.time_consuming, + empvalue: {myself: item.myself_experience, experience: item.experience}, + game_scores: {game_score: item.game_score, game_score_full: item.game_score_full}, + challenge_id: {id: item.challenge_id}, challenge_comment: item.challenge_comment, challenge_comment_hidden: item.challenge_comment_hidden, // adjustmentminute:asdasd @@ -97,7 +99,7 @@ class OfficialAcademicTranscript extends Component { }) } - let columns=[{ + let columns = [{ title: '关卡', dataIndex: 'customs', key: 'customs', @@ -110,13 +112,17 @@ class OfficialAcademicTranscript extends Component { title: '任务名称', dataIndex: 'taskname', key: 'taskname', - className:"TaskForms", + className: "TaskForms", render: (text, record) => ( - this.myjumptopic("id"+record.customs)} title={record.taskname.name.length>15?record.taskname.name:""} > + this.myjumptopic("id" + record.customs)} + title={record.taskname.name.length > 15 ? record.taskname.name : ""}> {record.taskname.name} - {record.taskname.complete_status===2?延时:record.taskname.complete_status===3?延时:""} + {record.taskname.complete_status === 2 ? + 延时 : record.taskname.complete_status === 3 ? + 延时 : ""} ), @@ -158,79 +164,101 @@ class OfficialAcademicTranscript extends Component { {record.elapsedtime} ), - }, { - title: '经验值', - key: 'empvalue', - dataIndex: 'empvalue', + }, + { + title: '查看答案', + dataIndex: 'view_answer', + key: 'view_answer', + className: "edu-txt-center", + render: (text, record) => { + return ( + {record.view_answer === true ? + 学生在完成任务评测之前查是否看了参考答案 + + }>已查看 : + 学生在完成任务评测之前查是否看了参考答案 + + }>未查看 } + ) + } + }, + { + title: '经验值', + key: 'empvalue', + dataIndex: 'empvalue', - render: (text, record) => ( - - {record.empvalue.myself}/{record.empvalue.experience} + render: (text, record) => ( + + {record.empvalue.myself}/{record.empvalue.experience} - ), - },{ - title: '关卡得分', - key: 'game_scores', - dataIndex: 'game_scores', - render: (text, record) => ( - + ), + }, { + title: '关卡得分', + key: 'game_scores', + dataIndex: 'game_scores', + render: (text, record) => ( + 关卡得分:{record.game_scores.game_score}/关卡满分:{record.game_scores.game_score_full} }> - {record.game_scores.game_score}/{record.game_scores.game_score_full} + {record.game_scores.game_score}/{record.game_scores.game_score_full} - ), - },{ - title: '调分', - key: 'adjustmentminute', - dataIndex: 'adjustmentminute', + ), + }, { + title: '调分', + key: 'adjustmentminute', + dataIndex: 'adjustmentminute', - render: (text, record) => ( - - this.editgame_scores(e,record.challenge_id.id,record.game_scores.game_score_full)} - // min={0} max={record.game_scores.game_score_full} + render: (text, record) => ( + + this.editgame_scores(e, record.challenge_id.id, record.game_scores.game_score_full)} + // min={0} max={record.game_scores.game_score_full} /> - {/*查看*/} + {/*查看*/} - ), - },{ - title: '操作', - key: 'operation', - dataIndex: 'operation', + ), + }, { + title: '操作', + key: 'operation', + dataIndex: 'operation', - render: (text, record) => ( - + render: (text, record) => ( + this.props.showAppraiseModal("child",record.challenge_id.id,record.challenge_comment,record.challenge_comment_hidden)} + onClick={() => this.props.showAppraiseModal("child", record.challenge_id.id, record.challenge_comment, record.challenge_comment_hidden)} >评阅 - ), - }]; - + ), + }]; - if(this.props.isAdmin()===false){ - columns.some((item,key)=> { - if (item.title === "调分") { - columns.splice(key, 1) - return true - } - } - ) - columns.some((item,key)=> { - if (item.title === "操作") { - columns.splice(key, 1) - return true - } - } - ) - } + if (this.props.isAdmin() === false) { + columns.some((item, key) => { + if (item.title === "调分") { + columns.splice(key, 1) + return true + } + } + ) + columns.some((item, key) => { + if (item.title === "操作") { + columns.splice(key, 1) + return true + } + } + ) + } return (
{/*{data===undefined?"":""}*/} @@ -301,10 +329,10 @@ class OfficialAcademicTranscript extends Component { } `} - {datas===undefined?"":}