Merge branch 'dev_aliyun' of http://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

problem_set
cxt 6 years ago
commit e733227360

@ -112,6 +112,8 @@ class ApplicationController < ActionController::Base
"验证码发送次数超过频率"
when 43
"一天内同一手机号发送次数超过限制"
when 53
"手机号接收超过频率限制"
end
end

@ -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

@ -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

@ -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

@ -17,14 +17,10 @@
<% myshixuns.each do |myshixun| %>
<tr class="myshixun-item-<%= myshixun.id %>">
<td><%= myshixun.id %></td>
<td>
<td><%= myshixun.identifier %></td>
<td class="text-left">
<% current_task = myshixun.last_executable_task || myshixun.last_task %>
<%= link_to "/myshixuns/#{myshixun.identifier}/stages/#{current_task.identifier}", target: '_blank' do %>
<%= myshixun.identifier %>
<% end %>
</td>
<td class="text-left">
<%= link_to "/shixuns/#{myshixun.shixun.identifier}", target: '_blank' do %>
<%= overflow_hidden_span myshixun.shixun.name, width: 280 %>
<% end %>
</td>

@ -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

@ -2,11 +2,13 @@
<thead class="thead-light">
<tr>
<th width="14%" class="text-left">姓名</th>
<th width="38%" class="text-left">单位部门</th>
<th width="12%"><%= sort_tag('学习关卡数', name: 'study_challenge_count', path: admins_user_statistics_path) %></th>
<th width="12%"><%= sort_tag('完成关卡数', name: 'finish_challenge_count', path: admins_user_statistics_path) %></th>
<th width="12%"><%= sort_tag('学习实训数', name: 'study_shixun_count', path: admins_user_statistics_path) %></th>
<th width="12%"><%= sort_tag('完成实训数', name: 'finish_shixun_count', path: admins_user_statistics_path) %></th>
<th width="22%" class="text-left">单位部门</th>
<th width="10%"><%= sort_tag('学习关卡数', name: 'study_challenge_count', path: admins_user_statistics_path) %></th>
<th width="10%"><%= sort_tag('完成关卡数', name: 'finish_challenge_count', path: admins_user_statistics_path) %></th>
<th width="10%"><%= sort_tag('学习实训数', name: 'study_shixun_count', path: admins_user_statistics_path) %></th>
<th width="10%"><%= sort_tag('完成实训数', name: 'finish_shixun_count', path: admins_user_statistics_path) %></th>
<th width="10%">评测次数</th>
<th width="14%">实战时间</th>
</tr>
</thead>
<tbody>
@ -23,6 +25,8 @@
<td><%= user.display_extra_data(:finish_challenge_count) %></td>
<td><%= user.display_extra_data(:study_shixun_count) %></td>
<td><%= user.display_extra_data(:finish_shixun_count) %></td>
<td><%= user.display_extra_data(:evaluate_count) %></td>
<td><%= Util.display_cost_time(user.display_extra_data(:cost_time)) || '--' %></td>
</tr>
<% end %>
<% else %>

@ -21,7 +21,7 @@
</div>
</div>
<%= f.input :link, as: :url, label: '跳转地址', placeholder: '请输入跳转地址' %>
<%= f.input :link, label: '跳转地址', placeholder: '请输入跳转地址' %>
<div class="error text-danger"></div>
<% end %>

@ -21,7 +21,7 @@
</div>
</div>
<%= f.input :link, as: :url, label: '跳转地址', placeholder: '请输入跳转地址' %>
<%= f.input :link, label: '跳转地址', placeholder: '请输入跳转地址' %>
<div class="error text-danger"></div>
<% end %>

@ -987,6 +987,7 @@ class Listofworksstudentone extends Component {
<Tooltip placement="bottom" title={<div>
<div>已通过{record.completion}{this.state.challenges_count}</div>
<div>完成任务评测之前查看了参考答案{record.view_answer_count}</div>
</div>}>
<span style={{color: '#07111B', "text-align": "center"}}>{record.completion+"/"+this.state.challenges_count} </span>
</Tooltip>
@ -1100,6 +1101,7 @@ class Listofworksstudentone extends Component {
:
<Tooltip placement="bottom" title={<div>
<div>{record.user_name}{record.user_login}</div>
<div>完成任务评测之前查看了参考答案{record.view_answer_count}</div>
<div>{record.levelscore === "--"?<span>关卡得分0</span> :<span>{record.levelscore}</span>}</div>
<div>{record.efficiencyscore === "--"?<span>效率评分0</span> :<span>{record.efficiencyscore}</span>}</div>
<div>{record.late_penalty === "--"?<span>迟交扣分0</span> :<span>{record.late_penalty}</span>}</div>
@ -1293,6 +1295,7 @@ class Listofworksstudentone extends Component {
<Tooltip placement="bottom" title={<div>
<div>已通过{record.completion}{this.state.challenges_count}</div>
<div>完成任务评测之前查看了参考答案{record.view_answer_count}</div>
</div>}>
<span style={{color: '#07111B',textAlign: "center"}}>{record.completion+"/"+this.state.challenges_count} </span>
</Tooltip>
@ -1406,6 +1409,7 @@ class Listofworksstudentone extends Component {
:
<Tooltip placement="bottom" title={<div>
<div>{record.user_name}{record.user_login}</div>
<div>完成任务评测之前查看了参考答案{record.view_answer_count}</div>
<div>{record.levelscore === "--"?<span>关卡得分0</span> :<span>{record.levelscore}</span>}</div>
<div>{record.efficiencyscore === "--"?<span>效率评分0</span> :<span>{record.efficiencyscore}</span>}</div>
<div>{record.late_penalty === "--"?<span>迟交扣分0</span> :<span>{record.late_penalty}</span>}</div>
@ -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,

@ -3,6 +3,7 @@ import {WordsBtn} from 'educoder';
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) {
@ -17,6 +18,7 @@ class OfficialAcademicTranscript extends Component {
componentDidMount() {
}
myjumptopic = (e) => {
console.log("获取到值");
console.log(e);
@ -113,10 +115,14 @@ class OfficialAcademicTranscript extends Component {
className: "TaskForms",
render: (text, record) => (
<span>
<span className={"task-hide linhe15"} style={{color:"#676767"}}><a className="tasknameName font-14" onClick={()=>this.myjumptopic("id"+record.customs)} title={record.taskname.name.length>15?record.taskname.name:""} >
<span className={"task-hide linhe15"} style={{color: "#676767"}}><a className="tasknameName font-14"
onClick={() => this.myjumptopic("id" + record.customs)}
title={record.taskname.name.length > 15 ? record.taskname.name : ""}>
{record.taskname.name}
</a>
{record.taskname.complete_status===2?<span className={"tasknamebox ml10"}>延时</span>:record.taskname.complete_status===3?<span className={"tasknameboxs ml10"}></span>:""}
{record.taskname.complete_status === 2 ?
<span className={"tasknamebox ml10"}>延时</span> : record.taskname.complete_status === 3 ?
<span className={"tasknameboxs ml10"}>延时</span> : ""}
</span>
</span>
),
@ -158,14 +164,35 @@ class OfficialAcademicTranscript extends Component {
{record.elapsedtime}
</span>
),
}, {
},
{
title: '查看答案',
dataIndex: 'view_answer',
key: 'view_answer',
className: "edu-txt-center",
render: (text, record) => {
return (
<span style={{cursor: "default"}}>{record.view_answer === true ? <Tooltip placement="bottom" title={
<pre>
学生在完成任务评测之前查是否看了参考答案
</pre>
}><span style={{cursor: "default"}}>已查看</span> </Tooltip> : <Tooltip placement="bottom" title={
<pre>
学生在完成任务评测之前查是否看了参考答案
</pre>
}><span style={{cursor: "default"}}>未查看</span> </Tooltip>}</span>
)
}
},
{
title: '经验值',
key: 'empvalue',
dataIndex: 'empvalue',
render: (text, record) => (
<span>
<span style={{color:'#29BD8B'}}>{record.empvalue.myself}</span><span className={"color-grey-9"}>/{record.empvalue.experience}</span>
<span style={{color: '#29BD8B'}}>{record.empvalue.myself}</span><span
className={"color-grey-9"}>/{record.empvalue.experience}</span>
</span>
),
}, {
@ -179,7 +206,8 @@ class OfficialAcademicTranscript extends Component {
关卡得分{record.game_scores.game_score}/关卡满分{record.game_scores.game_score_full}
</pre>
}>
<span style={{color:'#29BD8B'}}>{record.game_scores.game_score}</span><span className={"color-grey-9"}>/{record.game_scores.game_score_full}</span>
<span style={{color: '#29BD8B'}}>{record.game_scores.game_score}</span><span
className={"color-grey-9"}>/{record.game_scores.game_score_full}</span>
</Tooltip>
</span>
),
@ -190,7 +218,8 @@ class OfficialAcademicTranscript extends Component {
render: (text, record) => (
<span>
<a><InputNumber size="small" className={customsids===record.challenge_id.id?"bor-red":""} defaultValue={record.game_scores.game_score}
<a><InputNumber size="small" className={customsids === record.challenge_id.id ? "bor-red" : ""}
defaultValue={record.game_scores.game_score}
onBlur={(e) => this.editgame_scores(e, record.challenge_id.id, record.game_scores.game_score_full)}
// min={0} max={record.game_scores.game_score_full}
/></a>
@ -214,7 +243,6 @@ class OfficialAcademicTranscript extends Component {
}];
if (this.props.isAdmin() === false) {
columns.some((item, key) => {
if (item.title === "调分") {

Loading…
Cancel
Save