diff --git a/app/controllers/competition_teams_controller.rb b/app/controllers/competition_teams_controller.rb index b1d6788e..cfae2acf 100644 --- a/app/controllers/competition_teams_controller.rb +++ b/app/controllers/competition_teams_controller.rb @@ -14,6 +14,10 @@ class CompetitionTeamsController < ApplicationController def show return render_404 if @competition.identifier != 'gcc-course-2019' + end + + def shixun_detail + return render_404 if @competition.identifier != 'gcc-course-2019' @team_user_ids = @team.team_members.pluck(:user_id) @@ -40,13 +44,17 @@ class CompetitionTeamsController < ApplicationController @forked_course_count_map[forked_shixun_map[forked_id]] += course_count end @forked_shixun_map = forked_shixun_map + end + def course_detail + return render_404 if @competition.identifier != 'gcc-course-2019' + + @team_user_ids = @team.team_members.pluck(:user_id) - # 课堂 student_count_subquery = CourseMember.where('course_id = courses.id AND role = 4').select('count(*)').to_sql subquery = StudentWork.where('homework_common_id = hcs.id') - .select('sum(compelete_status !=0 ) as finish, count(*) as total') - .having('total != 0 and finish >= (total / 2)').to_sql + .select('sum(compelete_status !=0 ) as finish, count(*) as total') + .having('total != 0 and finish >= (total / 2)').to_sql course_ids = Course.where('courses.created_at > ?', Time.parse('2018-06-01')) .where('courses.created_at <= ?', @competition.end_time) .where("(#{student_count_subquery}) >= 3") @@ -55,7 +63,7 @@ class CompetitionTeamsController < ApplicationController .where(course_members: { user_id: @team_user_ids }).pluck(:id) courses = Course.where(id: course_ids).joins(:shixun_homework_commons).where('homework_commons.publish_time < now()') @courses = courses.select('courses.id, courses.name, courses.members_count, count(*) shixun_homework_count') - .group('courses.id').order('shixun_homework_count desc').having('shixun_homework_count > 0') + .group('courses.id').order('shixun_homework_count desc').having('shixun_homework_count > 0') course_ids = @courses.map(&:id) @course_myshixun_map = Myshixun.joins(student_works: :homework_common) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index ea6b37dc..e7273b94 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -2084,7 +2084,7 @@ end @school_id = params[:school_id] if params[:school_id] && params[:school_id] != '' - @courses = @courses.joins("join user_extensions ue on courses.tea_id = ue.user_id").where("ue.school_id = #{params[:school_id]}") + @courses = @courses.where(school_id: params[:school_id]) end if params[:homepage_show] @@ -4206,7 +4206,7 @@ end sheet1[count_row, 5] = show_shixun_mirror(shixun) sheet1[count_row, 6] = shixun.fork_identifier sheet1[count_row, 7] = shixun.challenges.count - sheet1[count_row, 8] = Setting.server_url + shixun_path(shixun) + sheet1[count_row, 8] = Setting.server_url + shixun_path(shixun).sub("/", "") count_row += 1 end book.write xls_report diff --git a/app/views/colleges/_course_statistics.html.erb b/app/views/colleges/_course_statistics.html.erb index b8608dc0..67e989f3 100644 --- a/app/views/colleges/_course_statistics.html.erb +++ b/app/views/colleges/_course_statistics.html.erb @@ -20,13 +20,13 @@ <%= course_managers course.teachers %>
翻转课堂
+创建者 | +名称 | +学生数量 | +发布的实训作业数量 | +有效作品数 | +经验值 | +
---|---|---|---|---|---|
<%= course.teachers.where(user_id: @team_user_ids).first.user.show_real_name %> | ++ <%= link_to course_path(course), target: '_blank' do %> + <%= course.name %> + <% end %> + | +<%= course.members_count %> | +<%= course['shixun_homework_count'].presence || '--' %> | +<%= @course_myshixun_map.fetch(course.id, '--') %> | +<%= score.zero? ? '--' : score %> | +
合计 | +<%= @courses.size %> | +<%= total_members_count %> | +<%= total_shixun_homework_count %> | +<%= @course_myshixun_map.values.reduce(:+) || 0 %> | +<%= total_course_score %> | +
实训项目
+创建者 | +名称 | +学习人数 | +fork版的学习人数 | +有效作品数 | +经验值 | +
---|---|---|---|---|---|
<%= shixun.creator.show_real_name %> | ++ <%= link_to shixun_path(shixun), target: '_blank' do %> + <%= shixun.name %> + <% end %> + <% if shixun.fork_from.blank? %> + 原创 + <% end %> + | +<%= shixun.myshixuns_count.to_i.zero? ? '--' : shixun.myshixuns_count.to_i %> | +<%= shixun['forked_myshixun_count'].to_i.zero? ? '--' : shixun['forked_myshixun_count'].to_i %> | +<%= @myshixun_count_map.fetch(shixun.id, '--') %> | +<%= score.zero? ? '--' : score %> | +
合计 | +<%= @shixuns.size %> | +<%= total_myshixun_count %> | +<%= total_forked_myshixun_count %> | +<%= @myshixun_count_map.values.reduce(:+) %> | +<%= total_shixun_score %> | +
实训项目
<%= shixun.creator.show_real_name %> | -- <%= link_to shixun_path(shixun), target: '_blank' do %> - <%= shixun.name %> - <% end %> - <% if shixun.fork_from.blank? %> - 原创 - <% end %> - | -<%= shixun.myshixuns_count.to_i.zero? ? '--' : shixun.myshixuns_count.to_i %> | -<%= shixun['forked_myshixun_count'].to_i.zero? ? '--' : shixun['forked_myshixun_count'].to_i %> | -<%= @myshixun_count_map.fetch(shixun.id, '--') %> | -<%= score.zero? ? '--' : score %> | -||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
加载中... | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
合计 | -<%= @shixuns.size %> | -<%= total_myshixun_count %> | -<%= total_forked_myshixun_count %> | -<%= @myshixun_count_map.values.reduce(:+) %> | -<%= total_shixun_score %> | ++ | + | + | + |
---|
翻转课堂
<%= course.teachers.where(user_id: @team_user_ids).first.user.show_real_name %> | -- <%= link_to course_path(course), target: '_blank' do %> - <%= course.name %> - <% end %> - | -<%= course.members_count %> | -<%= course['shixun_homework_count'].presence || '--' %> | -<%= @course_myshixun_map.fetch(course.id, '--') %> | -<%= score.zero? ? '--' : score %> | -||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
加载中... | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
合计 | -<%= @courses.size %> | -<%= total_members_count %> | -<%= total_shixun_homework_count %> | -<%= @course_myshixun_map.values.reduce(:+) || 0 %> | -<%= total_course_score %> | ++ | + | + | + |
---|