Merge branch 'dev_aliyun' into dev_item_bank

yslnewtiku
cxt 5 years ago
commit cab3a68719

@ -44,8 +44,8 @@ class CollegesController < ApplicationController
(SELECT count(c.id) FROM courses c, course_members m WHERE c.id != 1309 and m.course_id = c.id AND m.user_id=users.id AND m.role in (1,2,3) and c.school_id = #{current_school.id} AND c.is_delete = 0) as course_count
FROM `users`, user_extensions ue where ue.school_id=#{current_school.id} and users.id=ue.user_id and ue.identity=0 ORDER BY publish_shixun_count desc, course_count desc, id desc LIMIT 10")
# ).order("publish_shixun_count desc, experience desc").limit(10)
@teacher_count = UserExtension.where(school_id: current_school.id)
.select('SUM(IF(identity=0, 1, 0)) AS teachers_count').first.teachers_count
# @teacher_count = UserExtension.where(school_id: current_school.id)
# .select('SUM(IF(identity=0, 1, 0)) AS teachers_count').first.teachers_count
@teachers =
@teachers.map do |teacher|
course_ids = Course.find_by_sql("SELECT c.id FROM courses c, course_members m WHERE c.id != 1309 and m.course_id = c.id AND m.role in (1,2,3) AND m.user_id=#{teacher.id} AND c.is_delete = 0 and c.school_id = #{current_school.id}")
@ -99,7 +99,7 @@ class CollegesController < ApplicationController
@course_count = courses.size
courses = courses.left_joins(practice_homeworks: { student_works: { myshixun: :games } })
.select('courses.id, courses.name, courses.is_end, sum(games.evaluate_count) evaluating_count')
.select('courses.id, courses.name, courses.is_end, IFNULL(sum(games.evaluate_count), 0) evaluating_count')
.group('courses.id').order('is_end asc, evaluating_count desc')
@courses = paginate courses
@ -117,7 +117,7 @@ class CollegesController < ApplicationController
# 学生实训
def student_shixun
@student_count = User.joins(:user_extension).where(user_extensions: { school_id: current_school.id, identity: 1 }).count
# @student_count = User.joins(:user_extension).where(user_extensions: { school_id: current_school.id, identity: 1 }).count
@students = User.joins(:user_extension).where(user_extensions: { school_id: current_school.id, identity: 1 }).includes(:user_extension).order('experience desc').limit(10)
student_ids = @students.map(&:id)
@ -158,7 +158,7 @@ class CollegesController < ApplicationController
return true if current_user.admin_or_business? # 超级管理员|运营
return true if current_college.is_a?(Department) && current_college.member?(current_user) # 部门管理员
return true if current_user.is_teacher? && current_user.school_id == current_school.id # 学校老师
return true if current_school.customers.exists? && current_user.partner&.partner_customers&.exists?(customer_id: current_school.customer_id)
# return true if current_school.customers.exists? && current_user.partner&.partner_customers&.exists?(customer_id: current_school.customer_id)
false
end

@ -167,7 +167,11 @@ class HomeworkCommonsController < ApplicationController
if params[:work_status].present?
params_work_status = params[:work_status]
work_status = params_work_status.map{|status| status.to_i}
@student_works = @student_works.where(compelete_status: work_status)
if @homework.homework_type == "practice"
@student_works = @student_works.where(compelete_status: work_status)
else
@student_works = @student_works.where(work_status: work_status)
end
end
# 分班情况

@ -1,4 +0,0 @@
class Curriculum < ApplicationRecord
belongs_to :curriculum_direction
has_many :knowledge_points, dependent: :destroy
end

@ -1,4 +0,0 @@
class CurriculumDirection < ApplicationRecord
has_many :curriculums
has_many :knowledge_points
end

@ -3,8 +3,6 @@ class ItemBank < ApplicationRecord
# item_type: 0 单选 1 多选 2 判断 3 填空 4 简答 5 实训 6 编程
enum item_type: { SINGLE: 0, MULTIPLE: 1, JUDGMENT: 2, COMPLETION: 3, SUBJECTIVE: 4, PRACTICAL: 5, PROGRAM: 6 }
belongs_to :curriculum
belongs_to :curriculum_direction
belongs_to :user
has_one :item_analysis, dependent: :destroy

@ -1,5 +0,0 @@
class KnowledgePoint < ApplicationRecord
belongs_to :curriculum_direction
belongs_to :curriculum
has_many :knowledge_point_containers, dependent: :destroy
end

@ -1,3 +0,0 @@
class KnowledgePointContainer < ApplicationRecord
belongs_to :knowledge_point
end

@ -7,4 +7,4 @@ json.teachers @students do |student|
json.grade student.grade
json.experience student.experience
end
json.student_count @student_count
# json.student_count @student_count

@ -8,4 +8,4 @@ json.teachers @teachers do |teacher|
json.complete_rate teacher['complete_rate']
json.publish_shixun_count teacher['publish_shixun_count']
end
json.teacher_count @teacher_count
# json.teacher_count @teacher_count

@ -1,9 +0,0 @@
class CreateCurriculumDirections < ActiveRecord::Migration[5.2]
def change
create_table :curriculum_directions do |t|
t.string :name
t.timestamps
end
end
end

@ -1,10 +0,0 @@
class CreateCurriculums < ActiveRecord::Migration[5.2]
def change
create_table :curriculums do |t|
t.string :name
t.references :curriculum_direction, index: true
t.timestamps
end
end
end

@ -1,11 +0,0 @@
class CreateKnowledgePoints < ActiveRecord::Migration[5.2]
def change
create_table :knowledge_points do |t|
t.string :name
t.references :curriculum_direction, index: true
t.references :curriculum, index: true
t.timestamps
end
end
end

@ -1,12 +0,0 @@
class CreateKnowledgePointContainers < ActiveRecord::Migration[5.2]
def change
create_table :knowledge_point_containers do |t|
t.references :knowledge_point
t.integer :container_id
t.string :container_type
t.timestamps
end
add_index :knowledge_point_containers, [:knowledge_point_id, :container_id, :container_type], name: "container_index", unique: true
end
end

@ -300,6 +300,11 @@ const Developer = Loadable({
loader: () => import('./modules/developer'),
loading: Loading
})
// 学院统计
const College = Loadable({
loader: () => import('./college/College'),
loading: Loading
})
// 开发者编辑模块
const NewOrEditTask = Loadable({
@ -614,7 +619,10 @@ class App extends Component {
{/*/>*/}
<Route path="/shixuns/new" component={Newshixuns}>
</Route>
<Route path="/colleges/:id/statistics"
render={
(props) => (<College {...this.props} {...props} {...this.state} />)
}/>
{/* jupyter */}
<Route path="/tasks/:identifier/jupyter/"
render={
@ -707,6 +715,7 @@ class App extends Component {
}
}
/>
<Route
path="/problems/:id/edit"
render={
@ -721,6 +730,7 @@ class App extends Component {
render={
(props) => (<StudentStudy {...this.props} {...props} {...this.state} />)
} />
<Route path="/problems"
render={
(props) => (<Developer {...this.props} {...props} {...this.state} />)

File diff suppressed because it is too large Load Diff

@ -0,0 +1,84 @@
import React, {Component} from "react";
import {WordsBtn} from 'educoder';
import {Table} from "antd";
import {Link,Switch,Route,Redirect} from 'react-router-dom';
const echarts = require('echarts');
function startechart(data,datanane){
var effChart = echarts.init(document.getElementById('shixun_skill_chart'));
var option = {
tooltip : {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
legend: {
// orient: 'vertical',
// top: 'middle',
bottom: 40,
left: 'center',
data: datanane
},
series : [
{
type: 'pie',
radius : '65%',
center: ['50%', '35%'],
selectedMode: 'single',
data:data,
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
effChart.setOption(option);
}
class Colleagechart extends Component {
constructor(props) {
super(props);
this.state = {
}
}
componentDidMount() {
startechart(this.props.data,this.props.datanane)
}
componentDidUpdate = (prevProps) => {
if (prevProps.data!= this.props.data) {
startechart(this.props.data,this.props.datanane)
}
}
render() {
let {data}=this.props;
return (
<div>
<div
style={{ width:'410px',height:'600px'}}
id="shixun_skill_chart">
</div>
</div>
)
}
}
export default Colleagechart;

@ -0,0 +1,149 @@
import React, {Component} from "react";
import {WordsBtn} from 'educoder';
import {Table} from "antd";
import {Link,Switch,Route,Redirect} from 'react-router-dom';
const echarts = require('echarts');
function startechart(names, values){
var effChart = echarts.init(document.getElementById('shixun_skill_charts'));
var Color = ['#962e66', '#623363', '#CCCCCC', '#9A9A9A', '#FF8080', '#FF80C2', '#B980FF', '#80B9FF', '#6FE9FF', '#4DE8B4', '#F8EF63', '#FFB967'];
var option = {
backgroundColor: '#fff',
grid: {
left: '3%',
right: '4%',
bottom: '10%',
containLabel: true
},
tooltip: {
show: "true",
trigger: 'item',
formatter: '{c0}',
backgroundColor: 'rgba(0,0,0,0.7)', // 背景
padding: [8, 10], //内边距
extraCssText: 'box-shadow: 0 0 3px rgba(255, 255, 255, 0.4);', //添加阴影
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
xAxis: {
type: 'value',
axisTick: {
show: false
},
axisLine: {
show: true,
lineStyle: {
color: '#CCCCCC'
}
},
splitLine: {
show: false,
lineStyle: {
color: '#CCCCCC'
}
},
axisLabel: {
textStyle: {
color: '#656565',
fontWeight: 'normal',
fontSize: '12'
},
formatter: '{value}'
}
},
yAxis: {
type: 'category',
axisLine: {
lineStyle: {
color: '#cccccc'
}
},
splitLine: {
show: false
},
axisTick: {
show: false
},
splitArea: {
show: false
},
axisLabel: {
inside: false,
textStyle: {
color: '#656565',
fontWeight: 'normal',
fontSize: '12'
}
},
data: names
},
series: [{
name: '',
type: 'bar',
itemStyle: {
normal: {
show: true,
color: function(params) {
return Color[params.dataIndex]
},
barBorderRadius: 50,
borderWidth: 0,
borderColor: '#333'
}
},
barGap: '0%',
barCategoryGap: '50%',
data: values
}
]
};
effChart.setOption(option);
}
class Colleagechartzu extends Component {
constructor(props) {
super(props);
this.state = {
}
}
componentDidMount() {
startechart(this.props.data,this.props.datavule)
}
componentDidUpdate = (prevProps) => {
if (prevProps.data!= this.props.data) {
startechart(this.props.data,this.props.datavule)
}
}
render() {
let {data}=this.props;
return (
<div>
<div
style={{ width:'410px',height:'600px'}}
id="shixun_skill_charts">
</div>
</div>
)
}
}
export default Colleagechartzu;

@ -0,0 +1,213 @@
.yslstatistic-header {
width: 100%;
height: 240px;
background-image: url('/images/educoder/statistics.jpg');
background-size: 100% 100%;
}
.yslborder{
border: 1px solid;
}
.yslstatistic-header-title{
flex: 1;
display: flex;
align-items: center;
color: #4CACFF;
font-size: 32px;
}
.yslstatistic-header-content{
width: 100%;
display: flex;
justify-content: space-around;
}
.yslstatistic-header-item{
margin-bottom: 22px;
display: flex;
flex-direction: column;
align-items: center;
color: #fff;
}
.yslstatistic-header-item-label{
color: #989898;
}
.yslstatistic-base-item-label{
width: 200px;
text-align: center;
font-size: 16px;
height: 48px;
line-height: 48px;
color: #686868;
background: #F5F5F5;
border-top: 1px solid #EBEBEB;
}
.yslstatistic-base-item-labels{
width: 200px;
text-align: center;
height: 100px;
line-height: 100px;
background: #ffffff;
border-top: 1px solid #EBEBEB;
border-bottom: 1px solid #EBEBEB;
}
.yslstatistic-base-item-labelsp{
color: #000000;
font-size: 24px;
}
.yslstatistic-base-item-labelsspan{
color: #000000;
margin-left: 5px;
font-size: 16px;
}
.jibenshiyong100{
width: 100%;
}
.yslstatistic-header-item-content{
font-size: 24px;
}
/* 中间居中 */
.intermediatecenter{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
/* 简单居中 */
.intermediatecenterysls{
display: flex;
align-items: center;
}
.spacearound{
display: flex;
justify-content: space-around;
}
.spacebetween{
display: flex;
justify-content: space-between;
}
/* 头顶部居中 */
.topcenter{
display: -webkit-flex;
flex-direction: column;
align-items: center;
}
/* x轴正方向排序 */
/* 一 二 三 四 五 六 七 八 */
.sortinxdirection{
display: flex;
flex-direction:row;
}
/* x轴反方向排序 */
/* 八 七 六 五 四 三 二 一 */
.xaxisreverseorder{
display: flex;
flex-direction:row-reverse;
}
/* 垂直布局 正方向*/
/*
*/
.verticallayout{
display: flex;
flex-direction:column;
}
/* 垂直布局 反方向*/
.reversedirection{
display: flex;
flex-direction:column-reverse;
}
.h4{
font-size: 1.5rem;
font-weight: 500 !important;
}
.ysllinjibenshiyong{
font-weight: 500;
line-height: 1.2;
padding: 2rem 1.25rem;
border-bottom: unset;
background:#fff;
}
.linjibenshiyong{
font-weight: 500;
line-height: 1.2;
padding: 2rem 1.25rem;
border-bottom: unset;
background:#fff;
box-shadow:0px 6px 12px 0px rgba(0,0,0,0.1);
border-radius:2px;
}
.yslslinjibenshiyong{
font-weight: 500;
line-height: 1.2;
border-bottom: unset;
box-shadow:0px 6px 12px 0px rgba(0,0,0,0.1);
border-radius:2px;
}
.yinyin{
background: #fff;
box-shadow:0px 6px 12px 0px rgba(0,0,0,0.1);
border-radius:2px;
}
.edu-back-eeee{
background:#EEEEEE !important;
}
.mt-4{
margin-top: 1.5rem !important;
}
.statistic-label{
padding: 2rem 1.25rem;
font-size: 1.5rem;
font-weight: 400 !important;
}
.mb50{
padding-bottom: 50px !important;
}
.mt40{
margin-top: 40px;
}
.mb80{
margin-bottom: 80px;
}
.task-hide{overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
a:hover{
color:#0056b3;
}
.color-blue{
color: #4CACFF;
}
.color-huang{
color:#ffc107 !important
}
.maxnamewidth105{
max-width: 105px;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
cursor: default;
}
.maxnamewidth247{
max-width: 247px;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
cursor: default;
}
.maxnamewidth340{
max-width: 340px;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
cursor: default;
}

@ -1,5 +0,0 @@
require 'rails_helper'
RSpec.describe CurriculumDirection, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end

@ -1,5 +0,0 @@
require 'rails_helper'
RSpec.describe Curriculum, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end

@ -1,5 +0,0 @@
require 'rails_helper'
RSpec.describe KnowledgePointContainer, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end

@ -1,5 +0,0 @@
require 'rails_helper'
RSpec.describe KnowledgePoint, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end
Loading…
Cancel
Save