Merge branches 'dev_aliyun' and 'educoder' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into educoder

dev_aliyun
杨树明 5 years ago
commit 8521a15dde

@ -1,7 +1,9 @@
# encoding: utf-8 # encoding: utf-8
class CollegesController < ApplicationController class CollegesController < ApplicationController
before_filter :find_department, :only => [:statistics, :course_statistics, :student_shixun, :engineering_capability, :student_eval] before_filter :find_department, :only => [:statistics, :course_statistics, :student_shixun, :engineering_capability,
:student_eval, :shixun_time, :shixun_report_count, :teachers, :shixun_chart_data,
:student_hot_evaluations]
before_filter :manager_auth, :except => [:home, :get_home_data] before_filter :manager_auth, :except => [:home, :get_home_data]
include ApplicationHelper include ApplicationHelper
@ -42,143 +44,128 @@ class CollegesController < ApplicationController
end end
def statistics def statistics
logger.info("#########################{params}") # 教师、学生总数
@teachers_count = User.find_by_sql("SELECT COUNT(users.`id`) AS teacher_count FROM users LEFT JOIN user_extensions ON users.id=user_extensions.user_id WHERE count_statistic = UserExtensions.where(school_id: @school.id).select('SUM(IF(identity=0, 1, 0)) AS teachers_count, SUM(IF(identity=1, 1, 0)) AS students_count').first
user_extensions.`school_id` = #{@school.id} AND user_extensions.`identity` = 0").first.try(:teacher_count) @teachers_count = count_statistic['teachers_count']
@students_count = User.find_by_sql("SELECT COUNT(users.`id`) AS student_count FROM users LEFT JOIN user_extensions ON users.id=user_extensions.user_id WHERE @students_count = count_statistic['students_count']
user_extensions.`school_id` = #{@school.id} AND user_extensions.`identity` = 1").first.try(:student_count)
# Redo这样做内存会卡死的
# user_ids = User.find_by_sql("SELECT users.id FROM users LEFT JOIN user_extensions ON users.id=user_extensions.user_id WHERE user_extensions.`school_id` = #{@school.id}").map(&:id)
# Redo是否直接使用count会更好
all_course_ids = Course.where("id != 1309 and is_delete = 0 and school_id = #{@school.id}")
@courses_count = all_course_ids.size
# Redo对于量比较大的尽量不使用笛卡尔积
# @shixuns_count = Shixun.where(:status => [2, 3], :user_id => user_ids).size
@shixuns_count = Shixun.find_by_sql("select count(s.id) as shixun_count from users u right join shixuns s on u.id=s.user_id and s.status in (2, 3) inner join user_extensions ue on
u.id=ue.user_id and ue.school_id=#{@school.id}").first.try(:shixun_count)
# @shixun_time_sum = (Game.where(:user_id => user_ids).pluck(:cost_time).sum / (24*60*60.0)).ceil
@shixun_time_sum = (Game.find_by_sql("select sum(g.cost_time) cost_time from users u RIGHT join games g on u.id=g.user_id inner join user_extensions ue on
u.id=ue.user_id and ue.school_id=#{@school.id}").first.try(:cost_time).to_i / (24 * 60 * 60.0)).ceil
# select count(sw.id) from users u left join student_works sw on u.id=sw.user_id and sw.myshixun_id is not null and sw.work_status !=0 inner join user_extensions ue on u.id=ue.user_id and ue.school_id=117 ;
# @shixun_report_count = StudentWork.where("work_status != 0 and user_id in (#{user_ids.join(',').strip == "" ? -1 : user_ids.join(',')}) and myshixun_id is not null").count
@shixun_report_count = StudentWork.find_by_sql("SELECT count(*) as sw_count FROM `student_works` where user_id in (SELECT users.id FROM users RIGHT JOIN user_extensions ON users.id=user_extensions.user_id WHERE
user_extensions.`school_id`=#{@school.id}) and work_status between 1 and 2 and myshixun_id !=0").first.try(:sw_count)
# 课堂总数
@courses_count = Course.where(school_id: @school.id, is_delete: 0).where('id != 1309').count
# 实训总数
@shixuns_count = Shixun.visible.joins('left join user_extensions on user_extensions.user_id = shixuns.user_id').where(user_extensions: { school_id: @school.id }).count
respond_to do |format|
format.html {render :layout => "base_edu"}
end
end
def shixun_time
time_sum = Game.joins('left join user_extensions on user_extensions.user_id = games.user_id').where(user_extensions: { school_id: @school.id }).sum(:cost_time)
shixun_time_sum = (time_sum / (24 * 60 * 60.0)).ceil
render json: { shixun_time: shixun_time_sum }
end
def shixun_report_count
shixun_report_count = StudentWork.where(work_status: [1, 2]).where('myshixun_id != 0')
.joins('left join user_extensions on user_extensions.user_id = student_works.user_id')
.where(user_extensions: { school_id: @school.id }).count
render json: { shixun_report_count: shixun_report_count }
end
def teachers
@teachers = User.find_by_sql("SELECT users.id, users.login, users.lastname, users.firstname, users.nickname, IFNULL((SELECT count(shixuns.id) FROM shixuns where shixuns.user_id =users.id group by shixuns.user_id), 0) AS publish_shixun_count, @teachers = User.find_by_sql("SELECT users.id, users.login, users.lastname, users.firstname, users.nickname, IFNULL((SELECT count(shixuns.id) FROM shixuns where shixuns.user_id =users.id group by shixuns.user_id), 0) AS publish_shixun_count,
(SELECT count(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 c.school_id = #{@school.id} AND m.user_id=users.id AND c.is_delete = 0) as course_count (SELECT count(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 c.school_id = #{@school.id} AND m.user_id=users.id AND c.is_delete = 0) as course_count
FROM `users`, user_extensions ue where users.id=ue.user_id and ue.identity=0 and ue.school_id=#{@school.id} ORDER BY publish_shixun_count desc, course_count desc, id desc LIMIT 10") FROM `users`, user_extensions ue where users.id=ue.user_id and ue.identity=0 and ue.school_id=#{@school.id} ORDER BY publish_shixun_count desc, course_count desc, id desc LIMIT 10")
# ).order("publish_shixun_count desc, experience desc").limit(10) # ).order("publish_shixun_count desc, experience desc").limit(10)
@teachers = @teachers =
@teachers.map do |teacher| @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 = #{@school.id}") 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 = #{@school.id}")
course_count = course_ids.size course_count = course_ids.size
homeworks = HomeworkCommon.where(:homework_type => 4, :course_id => course_ids.map(&:id)) homeworks = HomeworkCommon.where(:homework_type => 4, :course_id => course_ids.map(&:id))
un_shixun_work_count = homeworks.where("publish_time > '#{Time.now}' or publish_time is null").count un_shixun_work_count = homeworks.where("publish_time > '#{Time.now}' or publish_time is null").count
shixun_work_count = homeworks.size - un_shixun_work_count shixun_work_count = homeworks.size - un_shixun_work_count
student_count = StudentsForCourse.where(:course_id => course_ids.map(&:id)).count student_count = StudentsForCourse.where(:course_id => course_ids.map(&:id)).count
myshixun_ids = StudentWork.select("myshixun_id").where("homework_common_id in (#{homeworks.map(&:id).join(',').strip == "" ? -1 : homeworks.map(&:id).join(',')}) and myshixun_id is not null") myshixun_ids = StudentWork.select("myshixun_id").where("homework_common_id in (#{homeworks.map(&:id).join(',').strip == "" ? -1 : homeworks.map(&:id).join(',')}) and myshixun_id is not null")
complete_myshixun = Myshixun.select("id").where(:status => 1, :id => myshixun_ids.map(&:myshixun_id)).size complete_myshixun = Myshixun.select("id").where(:status => 1, :id => myshixun_ids.map(&:myshixun_id)).size
all_myshixun = Myshixun.select("id").where(:id => myshixun_ids.map(&:myshixun_id)).size all_myshixun = Myshixun.select("id").where(:id => myshixun_ids.map(&:myshixun_id)).size
complete_rate = all_myshixun == 0 ? 0 : ((complete_myshixun * 100) / all_myshixun).try(:round, 2).to_f complete_rate = all_myshixun == 0 ? 0 : ((complete_myshixun * 100) / all_myshixun).try(:round, 2).to_f
real_name = teacher.show_real_name real_name = teacher.show_real_name
teacher = teacher.attributes.dup.merge({ teacher = teacher.attributes.dup.merge({
real_name: real_name, real_name: real_name,
course_count: course_count, course_count: course_count,
shixun_work_count: shixun_work_count, shixun_work_count: shixun_work_count,
un_shixun_work_count: un_shixun_work_count, un_shixun_work_count: un_shixun_work_count,
student_count: student_count, student_count: student_count,
complete_rate: complete_rate complete_rate: complete_rate
}).to_json }).to_json
JSON.parse(teacher) JSON.parse(teacher)
end end
end
shixun_ids = HomeworkCommonsShixuns.find_by_sql("SELECT hcs.shixun_id FROM homework_commons_shixuns hcs, homework_commons hc
WHERE hc.course_id in (#{all_course_ids.map(&:id).join(',').strip == "" ? -1 : all_course_ids.map(&:id).join(',')}) def shixun_chart_data
AND hcs.homework_common_id = hc.id").map(&:shixun_id) shixun_ids = HomeworkCommonsShixuns.joins(homework_common: :course).where(courses: {school_id: @school.id, is_delete: 0}).where('courses.id != 1309').pluck('distinct shixun_id')
shixun_tags = TagRepertoire.find_by_sql("SELECT tr.`name`, COUNT(str.shixun_id) as shixun_count FROM tag_repertoires tr, shixun_count_map = ShixunTagRepertoire.joins(:tag_repertoire).where(shixun_id: shixun_ids).group('tag_repertoires.name').order('count_shixun_id desc').count(:shixun_id)
shixun_tag_repertoires str WHERE tr.id = str.tag_repertoire_id AND str.shixun_id
IN (#{shixun_ids.join(',').strip == "" ? -1 : shixun_ids.join(',')}) GROUP BY tr.id names = []
order by shixun_count desc") data = []
all_shixun_count = shixun_tags.map(&:shixun_count).sum shixun_count_map.each do |name, count|
other_count = all_shixun_count.to_i - shixun_tags[0..8].map(&:shixun_count).sum.to_i break if names.size == 9
@shixun_tags_name = []
@shixun_tags_data = [] names << name
shixun_tags[0..8].each do |tag| data << { value: count, name: name }
@shixun_tags_name << tag.name
@shixun_tags_data << {value: tag.shixun_count, name: tag.name}
end
if shixun_tags.size > 9
@shixun_tags_name << 'Others'
@shixun_tags_data << {value: other_count, name: 'Others'}
end end
respond_to do |format| if shixun_count_map.keys.size > 9
format.html {render :layout => "base_edu"} other_count = shixun_count_map.values[9..-1].reduce(:+)
names << 'Others'
data << { name: 'Others', value: other_count }
end end
render json: { names: names, data: data }
end end
# 在线课堂 # 在线课堂
def course_statistics def course_statistics
@courses = Course.find_by_sql("SELECT c.id, (select concat(lastname,firstname) from users u where u.id=c.tea_id) as username, courses = Course.where(school_id: @school.id, is_delete: 0)
(select count(sfc.id) from students_for_courses sfc where c.id=sfc.course_id group by c.id) as student_count,
(select count(hc.id) from homework_commons hc where c.id=hc.course_id and hc.homework_type=4 group by c.id) as hcm_count, @obj_count = courses.count
(select count(hc.id) from homework_commons hc where c.id=hc.course_id and hc.homework_type in (1,3) group by c.id) as hcm_nonshixun_count,
(select count(e.id) from exercises e where c.id=e.course_id group by c.id) as exercises_count, courses = courses.joins(shixun_homework_commons: :student_works)
(select count(p.id) from polls p where c.id=p.course_id group by c.id) as polls_count, .joins('join games on games.myshixun_id = student_works.myshixun_id')
(select count(a.id) from attachments a where c.id=a.container_id and a.container_type='Course' group by c.id) as attachments_count, .select('courses.id, courses.name, courses.is_end, sum(games.evaluate_count) evaluating_count')
(select count(m.id) from messages m inner join boards b on b.id=m.board_id and b.parent_id=0 where b.course_id=c.id group by c.id) as messages_count, .group('courses.id').order('is_end asc, evaluating_count desc')
c.tea_id, c.name, c.is_end,
(SELECT MAX(created_at) FROM `course_activities` ca WHERE ca.course_id = c.id) AS update_time @obj_pages = Paginator.new @obj_count, 8, params['page']
FROM `courses` c WHERE c.school_id = #{@school.id} and c.is_delete = 0") @courses = courses.limit(@obj_pages.per_page).offset(@obj_pages.offset)
@courses.each do |course| course_ids = @courses.map(&:id)
course[:evaluating_count] = Output.find_by_sql("select sum(g.evaluate_count) as evaluating_count from games g inner join @student_count = StudentsForCourse.where(course_id: course_ids).group(:course_id).count
(select myshixun_id from student_works sw inner join homework_commons hc on sw.homework_common_id=hc.id and @shixun_work_count = HomeworkCommon.where(homework_type: 4, course_id: course_ids).group(:course_id).count
sw.myshixun_id !=0 and hc.course_id=#{course.id} and homework_type=4) aa on g.myshixun_id=aa.myshixun_id").first.try(:evaluating_count).to_i @attachment_count = Attachment.where(container_id: course_ids, container_type: 'Course').group(:container_id).count
course[:task_count] = course.hcm_count.to_i + course.attachments_count.to_i + course.messages_count.to_i + course.hcm_nonshixun_count.to_i + course.exercises_count.to_i + course.polls_count.to_i @message_count = Message.joins(:board).where(boards: { parent_id: 0, course_id: course_ids }).group('boards.course_id').count
end @active_time = CourseActivity.where(course_id: course_ids).group(:course_id).maximum(:created_at)
@courses = @courses.sort{|x,y| [y[:evaluating_count], y[:task_count]] <=> [x[:evaluating_count], x[:task_count]] } @exercise_count = Exercise.where(course_id: course_ids).group(:course_id).count
@courses = @courses.sort_by { |course| course.is_end ? 1 : 0 } @poll_count = Poll.where(course_id: course_ids).group(:course_id).count
@other_work_count = HomeworkCommon.where(homework_type: [1,3], course_id: course_ids).group(:course_id).count
# SELECT c.id, (select concat(firstname,lastname) from users u where u.id=c.tea_id) as username,
# (select count(sfc.id) from students_for_courses sfc where c.id=sfc.course_id group by c.id) as student_count,
# (select count(hc.id) from homework_commons hc where c.id=hc.course_id and hc.homework_type=4 group by c.id) as hcm_count,
# c.tea_id, c.name, c.is_end,
# (SELECT MAX(created_at) FROM `course_activities` ca WHERE ca.course_id = c.id) AS update_time
# FROM `courses` c WHERE (c.school_id = 117 and c.is_delete = 0) ORDER BY update_time desc LIMIT 8 OFFSET 0
# @courses = Course.where("courses.school_id = #{@department.school_id} and courses.is_delete = 0").select("courses.id, courses.tea_id, courses.name, courses.is_end,
# (SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS update_time").order("update_time desc")
@courses = paginateHelper @courses, 8
# @courses = @courses.includes(:student, :boards, :exercises, :polls, :attachments, :homework_commons, :teacher => [:user_extensions])
end end
# 学生实训 # 学生实训
def student_shixun def student_shixun
user_ids = User.find_by_sql("SELECT users.id FROM users, user_extensions WHERE users.id=user_extensions.user_id AND user_extensions.`school_id` = #{@school.id}").map(&:id) @students = User.joins(:user_extensions).where(user_extensions: { school_id: @school.id, identity: 1 }).includes(:user_extensions).order('experience desc').limit(10)
@students = User.find_by_sql("SELECT users.id, users.login, users.lastname, users.firstname, users.nickname, users.grade,
users.experience, ue.student_id, (SELECT COUNT(myshixuns.id) FROM `myshixuns` WHERE myshixuns.user_id student_ids = @students.map(&:id)
= users.id AND myshixuns.status = 1 GROUP BY users.id) AS myshixun_count FROM users join user_extensions ue on @shixun_count = Myshixun.where(user_id: student_ids).group(:user_id).count
users.id = ue.user_id where ue.school_id = #{@school.id} AND ue.identity = 1 AND `users`.`type` IN ('User', 'AnonymousUser') ORDER BY experience DESC, myshixun_count DESC LIMIT 10") @study_shixun_count = Myshixun.where(user_id: student_ids, status: 0).group(:user_id).count
end
## outputs基数过大用inner join有奇效
@shixun_tags = TagRepertoire.find_by_sql(%Q{ def student_hot_evaluations
select name, COUNT(outputs.id) AS test_count from outputs inner join ( games = Game.unscoped().joins(:myshixun).joins('join shixun_tag_repertoires str on str.shixun_id = myshixuns.shixun_id')
SELECT tr.id as trid, tr.`name` as name, games.id as id games = games.joins('join tag_repertoires tr on tr.id = str.tag_repertoire_id')
FROM tag_repertoires tr, shixun_tag_repertoires str, games, myshixuns games = games.joins("join user_extensions ue on ue.user_id = myshixuns.user_id and ue.school_id = #{@school.id}")
WHERE tr.id = str.tag_repertoire_id evaluate_count_map = games.group('tr.name').reorder('sum_games_evaluate_count desc').limit(10).sum('games.evaluate_count')
AND str.shixun_id = myshixuns.`shixun_id`
AND myshixuns.id = games.`myshixun_id`
AND myshixuns.`user_id` IN (
SELECT users.id FROM users, user_extensions WHERE users.id=user_extensions.user_id AND user_extensions.`school_id` = #{@school.id}
)
) a on a.id = outputs.game_id and outputs.`test_set_position` = 1 group by trid
ORDER BY test_count DESC
LIMIT 10
})
render json: { names: evaluate_count_map.keys, values: evaluate_count_map.values }
end end
# 工程能力 # 工程能力

@ -1,8 +1,8 @@
class TagRepertoire < ActiveRecord::Base class TagRepertoire < ActiveRecord::Base
# attr_accessible :title, :body # attr_accessible :title, :body
belongs_to :sub_repertoire belongs_to :sub_repertoire
has_many :shixuns, :through => :shixun_tag_repertoires
has_many :shixun_tag_repertoires, :dependent => :destroy has_many :shixun_tag_repertoires, :dependent => :destroy
has_many :shixuns, :through => :shixun_tag_repertoires
has_many :memos, :through => :memo_tag_repertoires has_many :memos, :through => :memo_tag_repertoires
has_many :memo_tag_repertoires, :dependent => :destroy has_many :memo_tag_repertoires, :dependent => :destroy

@ -20,13 +20,13 @@
<%= course_managers course.teachers %> <%= course_managers course.teachers %>
</td> </td>
<td class="edu-txt-center"><%= course.evaluating_count %></td> <td class="edu-txt-center"><%= course.evaluating_count %></td>
<td class="edu-txt-center"><%= course.student_count.to_i %></td> <td class="edu-txt-center"><%= @student_count.fetch(course.id, 0) %></td>
<td class="edu-txt-center"><%= course.hcm_count.to_i %></td> <td class="edu-txt-center"><%= @shixun_work_count.fetch(course.id, 0) %></td>
<td class="edu-txt-center"><%= course.attachments_count.to_i %></td> <td class="edu-txt-center"><%= @attachment_count.fetch(course.id, 0) %></td>
<td class="edu-txt-center"><%= course.messages_count.to_i %></td> <td class="edu-txt-center"><%= @message_count.fetch(course.id, 0) %></td>
<td class="edu-txt-center"><%= course.hcm_nonshixun_count.to_i + course.exercises_count.to_i + course.polls_count.to_i %></td> <td class="edu-txt-center"><%= @exercise_count.fetch(course.id, 0) + @poll_count.fetch(course.id, 0) + @other_work_count.fetch(course.id, 0) %></td>
<td class="edu-txt-center <%= course.is_end ? "color-grey-98" : "color-orange" %>"><%= course.is_end ? "已结束" : "正在进行" %></td> <td class="edu-txt-center <%= course.is_end ? "color-grey-98" : "color-orange" %>"><%= course.is_end ? "已结束" : "正在进行" %></td>
<td class="edu-txt-center color-grey-9"><%= format_time course.update_time %></td> <td class="edu-txt-center color-grey-9"><%= format_time @active_time[course.id] %></td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>

@ -21,8 +21,8 @@
<a href="<%= user_path(student) %>" target="_blank" class="task-hide" style="max-width: 84px;"><%= student.show_real_name %></a> <a href="<%= user_path(student) %>" target="_blank" class="task-hide" style="max-width: 84px;"><%= student.show_real_name %></a>
</td> </td>
<td><%= student.student_id %></td> <td><%= student.student_id %></td>
<td><%= student.myshixun_count %></td> <td><%= @shixun_count.fetch(student.id, 0) %></td>
<td><%= student.myshixuns.where(:status => 0).count %></td> <td><%= @study_shixun_count.fetch(student.id, 0) %></td>
<td><%= student.grade %></td> <td><%= student.grade %></td>
<td class="color-blue"><%= student.experience %></td> <td class="color-blue"><%= student.experience %></td>
</tr> </tr>
@ -32,14 +32,15 @@
<script> <script>
$(function(){ $(function(){
//初始化最热评测柱状图 //初始化最热评测柱状图
InitHotEvaluating(); $.get('<%= student_hot_evaluations_college_path(@school) %>', function(data){
InitHotEvaluating(data.names.reverse(), data.values.reverse());
})
}); });
function InitHotEvaluating(){ function InitHotEvaluating(names, values){
var Color = ['#962e66', '#623363', '#CCCCCC', '#9A9A9A', '#FF8080', '#FF80C2', '#B980FF', '#80B9FF', '#6FE9FF', '#4DE8B4', '#F8EF63', '#FFB967']; var Color = ['#962e66', '#623363', '#CCCCCC', '#9A9A9A', '#FF8080', '#FF80C2', '#B980FF', '#80B9FF', '#6FE9FF', '#4DE8B4', '#F8EF63', '#FFB967'];
var xData = function() { var xData = function() {
var data = <%= raw @shixun_tags.map(&:name).reverse %>; return names;
return data;
}(); }();
option = { option = {
@ -112,7 +113,7 @@
fontSize: '12' fontSize: '12'
} }
}, },
data: xData data: names
}, },
series: [{ series: [{
name: '', name: '',
@ -130,7 +131,7 @@
}, },
barGap: '0%', barGap: '0%',
barCategoryGap: '50%', barCategoryGap: '50%',
data: <%= raw @shixun_tags.map(&:test_count).reverse %> data: values
} }
] ]

@ -0,0 +1,17 @@
<% @teachers.each_with_index do |teacher, index| %>
<tr>
<td class="pl20 pr20">
<% if index < 3 %>
<img src="/images/educoder/competition/<%= index + 1 %>.png" width="18px" height="22px" class="mt8"/></td>
<% else %>
<%= index + 1 %>
<% end %>
<td class="color-dark"><a href="<%= user_path(teacher['login']) %>" target="_blank" class="task-hide" style="max-width: 84px;"><%= teacher['real_name'] %></a></td>
<td><%= teacher['course_count'] %></td>
<td><%= teacher['shixun_work_count'] %></td>
<td><%= teacher['un_shixun_work_count'] %></td>
<td><%= teacher['student_count'] %></td>
<td><%= teacher['complete_rate'] %>%</td>
<td class="color-blue"><%= teacher['publish_shixun_count'].to_i %></td>
</tr>
<% end %>

@ -42,8 +42,8 @@
<li><span><%= @students_count %></span>人</li> <li><span><%= @students_count %></span>人</li>
<li><span><%= @courses_count %></span>个</li> <li><span><%= @courses_count %></span>个</li>
<li><span><%= @shixuns_count %></span>个</li> <li><span><%= @shixuns_count %></span>个</li>
<li><span><%= @shixun_report_count %></span>个</li> <li class="shixun-report-count">加载中</li>
<li><span data-tip-down="所有学员的实训耗时之和"><span><%= @shixun_time_sum %></span>天</span></li> <li class="shixun-time">加载中</li>
<!-- <li><span><%#= @department.present? ? @department.host_count.to_i : @school.departments.first.try(:host_count).to_i %></span>台</li>--> <!-- <li><span><%#= @department.present? ? @department.host_count.to_i : @school.departments.first.try(:host_count).to_i %></span>台</li>-->
</div> </div>
</div> </div>
@ -76,23 +76,7 @@
<th>发布实训</th> <th>发布实训</th>
</thead> </thead>
<tbody> <tbody>
<% @teachers.each_with_index do |teacher, index| %> <tr><td colspan="100" style="height:400px">加载中...</td></tr>
<tr>
<td class="pl20 pr20">
<% if index < 3 %>
<img src="/images/educoder/competition/<%= index + 1 %>.png" width="18px" height="22px" class="mt8"/></td>
<% else %>
<%= index + 1 %>
<% end %>
<td class="color-dark"><a href="<%= user_path(teacher['login']) %>" target="_blank" class="task-hide" style="max-width: 84px;"><%= teacher['real_name'] %></a></td>
<td><%= teacher['course_count'] %></td>
<td><%= teacher['shixun_work_count'] %></td>
<td><%= teacher['un_shixun_work_count'] %></td>
<td><%= teacher['student_count'] %></td>
<td><%= teacher['complete_rate'] %>%</td>
<td class="color-blue"><%= teacher['publish_shixun_count'].to_i %></td>
</tr>
<% end %>
</tbody> </tbody>
</table> </table>
</div> </div>
@ -100,12 +84,9 @@
<div class="fl width40"> <div class="fl width40">
<div class="online_status static_shadow"> <div class="online_status static_shadow">
<p class="font-24 padding30-20">在线实训情况</p> <p class="font-24 padding30-20">在线实训情况</p>
<% if @shixun_tags_name.size == 0 %> <div class="pie-chart-loading" style="width: 440px;height: 480px; text-align: center; padding: 150px 0; box-sizing: border-box;">加载中...</div>
<%= render :partial => 'welcome/no_data' %> <%= render :partial => 'welcome/no_data', locals: { style: 'display: none' } %>
<div id="pieChart"></div> <div id="pieChart"></div>
<% else %>
<div id="pieChart" style="height: 440px;width: 480px;"></div>
<% end %>
</div> </div>
</div> </div>
</div> </div>
@ -158,7 +139,15 @@
}) })
}); });
$.get('<%= course_statistics_college_path(@school) %>'); $.get('<%= shixun_time_college_path(@school) %>', function(data){
$('.shixun-time').html("<span data-tip-down=\"所有学员的实训耗时之和\">" + data.shixun_time + "</span>天");
});
$.get('<%= shixun_report_count_college_path(@school) %>', function(data){
$('.shixun-report-count').html("<span>" + data.shixun_report_count + "</span>个");
});
// 教师排名
$.ajax({ url: '<%= teachers_college_path(@school) %>', method: 'GET', dataType: 'script' })
$(".count_student_test a").click(function(){ $(".count_student_test a").click(function(){
$(".count_student_test a").removeClass("active"); $(".count_student_test a").removeClass("active");
@ -166,9 +155,20 @@
}); });
//初始化饼状图 //初始化饼状图
InitPieChart(); $.get('<%= shixun_chart_data_college_path(@school) %>', function(data){
$('.pie-chart-loading').hide();
if (data.names.length > 0) {
$('.online_status .edu-tab-con-box').hide();
$('#pieChart').css('height', '440px').css('width', '480px')
InitPieChart(data.names, data.data);
} else {
$('.online_status .edu-tab-con-box').show();
}
});
$.get('<%= course_statistics_college_path(@school) %>');
}); });
function InitPieChart(){ function InitPieChart(names, data){
var Color = ['#49A9EE', '#FFD86E', '#98D87D', '#8996E6', '#F3857B', '#B97BF3','#4DE8B4','#F37BDB','#566EFF','#FF961A']; var Color = ['#49A9EE', '#FFD86E', '#98D87D', '#8996E6', '#F3857B', '#B97BF3','#4DE8B4','#F37BDB','#566EFF','#FF961A'];
option = { option = {
@ -185,7 +185,7 @@
bottom: 20, bottom: 20,
left: 20, left: 20,
right:20, right:20,
data: <%= raw @shixun_tags_name %> data: names
}, },
series : [ series : [
{ {
@ -193,7 +193,7 @@
radius : '50%', radius : '50%',
center: ['50%', '35%'], center: ['50%', '35%'],
selectedMode: 'single', selectedMode: 'single',
data:<%= raw @shixun_tags_data.to_json %>, data: data,
itemStyle: { itemStyle: {
emphasis: { emphasis: {
shadowBlur: 10, shadowBlur: 10,

@ -0,0 +1 @@
$('.teacher_ranking table tbody').html("<%= j(render :partial => 'colleges/teacher_ranking') %>")

@ -75,7 +75,9 @@
<%= render :partial => 'attachments/issue_reply', :locals => {:container => @issue} %> <%= render :partial => 'attachments/issue_reply', :locals => {:container => @issue} %>
</div> </div>
<span nhname='contentmsg_<%= @issue.id %>' class="fl mt5"></span> <span nhname='contentmsg_<%= @issue.id %>' class="fl mt5"></span>
<a id="new_message_submit_btn_<%= @issue.id %>" href="javascript:void(0)" onclick="this.style.display='none'" class="shixun-task-btn task-btn-orange fr mt5 mb10" style="display:none;">发送</a> <a id="new_message_submit_btn_<%= @issue.id %>" href="javascript:void(0)"
class="shixun-task-btn task-btn-orange fr mt5 mb10"
>发送</a>
<div class="cl"></div> <div class="cl"></div>
<% end %> <% end %>
</div> </div>

@ -1,4 +1,5 @@
<div class="edu-tab-con-box clearfix edu-txt-center"> <% style ||= '' %>
<div class="edu-tab-con-box clearfix edu-txt-center" style="<%= style %>">
<img class="edu-nodata-img mb20" src="/images/educoder/nodata.png"/> <img class="edu-nodata-img mb20" src="/images/educoder/nodata.png"/>
<p class="edu-nodata-p mb20">暂无数据哦~</p> <p class="edu-nodata-p mb20">暂无数据哦~</p>
</div> </div>

@ -1008,6 +1008,11 @@ RedmineApp::Application.routes.draw do ## oauth相关
get 'student_eval' get 'student_eval'
get 'home' get 'home'
get 'get_home_data' get 'get_home_data'
get 'shixun_time'
get 'shixun_report_count'
get 'teachers'
get 'shixun_chart_data'
get 'student_hot_evaluations'
end end
collection do collection do

@ -1096,7 +1096,7 @@ a:hover.link_file_a{ background:url(../images/pic_file.png) 0 -25px no-repeat; c
select.InputBox, input.InputBox, textarea.InputBox {border: 1px solid #D9D9D9;color: #888;height: 28px;line-height: 28px;padding-left: 5px;font-size: 14px;} select.InputBox, input.InputBox, textarea.InputBox {border: 1px solid #D9D9D9;color: #888;height: 28px;line-height: 28px;padding-left: 5px;font-size: 14px;}
.w713 {width: 713px;} .w713 {width: 713px;}
a.BlueCirBtnMini{ display:block;width:40px; height:22px; background-color:#ffffff; line-height:24px; vertical-align:middle; text-align:center; border:1px solid #269ac9; color:#269ac9; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;} a.BlueCirBtnMini{ display:block;width:40px; height:22px; background-color:#ffffff; line-height:24px; vertical-align:middle; text-align:center; border:1px solid #269ac9; color:#269ac9; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;}
a.AnnexBtn{ background: url(images/homepage_icon2.png) 0px -343px no-repeat !important; width:70px; height:20px; display:block; padding-left:20px; color:#888888;} a.AnnexBtn{ line-height: 20px; background: url(images/homepage_icon2.png) 0px -343px no-repeat !important; width:70px; height:20px; display:block; padding-left:20px; color:#888888;}
a:hover.BlueCirBtnMini{ background:#269ac9; color:#fff;} a:hover.BlueCirBtnMini{ background:#269ac9; color:#fff;}
.sticky_btn_cir{ background:#269ac9; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;} .sticky_btn_cir{ background:#269ac9; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;}
.locked_btn_cir{background: url("../images/locked.png") 0 0 no-repeat; cursor: default;} .locked_btn_cir{background: url("../images/locked.png") 0 0 no-repeat; cursor: default;}

Loading…
Cancel
Save