From 6a51ceb6d134d141fb01d293c6aef531cbb893e4 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Tue, 8 Oct 2019 17:23:28 +0800 Subject: [PATCH 01/50] modify training 2019 --- app/models/training.rb | 2 +- app/views/layouts/base_trainings.html.erb | 4 ++-- app/views/managements/training_2018.html.erb | 2 +- app/views/trainings/enroll.html.erb | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/models/training.rb b/app/models/training.rb index d7e99620..c94dee50 100644 --- a/app/models/training.rb +++ b/app/models/training.rb @@ -3,7 +3,7 @@ class Training < ActiveRecord::Base attr_accessible :address, :email, :name, :phone, :position, :school, :sex, :openid, :training_type, :major, :student_id, :job_title, :uncertified_major - # training_type 1 2018-培训会 2 警察学院大数据培训会 3 大数据和人工智能 4 工程教育认证 5 EduCoder-创先源于实践 + # training_type 1 2018-培训会 2 警察学院大数据培训会 3 大数据和人工智能 4 工程教育认证 5 EduCoder-创新源于实践 has_one :training_payinfo diff --git a/app/views/layouts/base_trainings.html.erb b/app/views/layouts/base_trainings.html.erb index 51115cb1..9c2e8a92 100644 --- a/app/views/layouts/base_trainings.html.erb +++ b/app/views/layouts/base_trainings.html.erb @@ -5,8 +5,8 @@ <%= case "#{params[:controller]}-#{params[:action]}" - when 'trainings-show' then '报名信息' - when 'trainings-enroll' then '报名' + when 'trainings-show' then 'EduCoder-IT专业教学与实战平台' + when 'trainings-enroll' then 'EduCoder-IT专业教学与实战平台' when 'trainings-pay' then '费用支付和发票信息' when 'trainings-result' then '支付信息' end diff --git a/app/views/managements/training_2018.html.erb b/app/views/managements/training_2018.html.erb index 678d4a08..92941745 100644 --- a/app/views/managements/training_2018.html.erb +++ b/app/views/managements/training_2018.html.erb @@ -7,7 +7,7 @@ <option value="2">2019湖南警察学院大数据培训</option> <option value="3">信息技术新工科产学研联盟师资培训班</option> <option value="4">工程教育认证</option> - <option value="5">EduCoder-创先源于实践</option> + <option value="5">EduCoder-创新源于实践</option> </select> <select class="fl mr10 winput-120-30" name="pay_type"> <option value="-1">选择支付方式</option> diff --git a/app/views/trainings/enroll.html.erb b/app/views/trainings/enroll.html.erb index 5279f51d..23f66e44 100644 --- a/app/views/trainings/enroll.html.erb +++ b/app/views/trainings/enroll.html.erb @@ -284,7 +284,7 @@ <% end %> <% if @training_type == 5 %> <div> - <p class="collegeInfo">EduCoder-创先源于实践</p> +<!-- <p class="collegeInfo">EduCoder-创新源于实践</p>--> <%= form_for @training do |f| %> <%= hidden_field_tag(:friendly_id, @friendly_id) %> From 64f56cf552b39afe675dd00431761a3767fb5cf0 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 8 Oct 2019 17:37:35 +0800 Subject: [PATCH 02/50] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E5=BC=B9=E6=A1=86?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_logined_header.html.erb | 15 --------------- app/views/layouts/_unlogin_header.html.erb | 12 ------------ 2 files changed, 27 deletions(-) diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index 3e57fce3..6da60505 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -139,21 +139,6 @@ display: none; right:110px;"> <% end %> <% end %> - var begin_time = new Date(); - var end_time = new Date("2019-10-10"); - if (begin_time < end_time) { - if (window.localStorage) { - var uid = localStorage.getItem('competition_uid'); - } else { - var uid = false - } - if (!uid) { - var htmlvalue = "<%= escape_javascript(render :partial => 'competitions/competitions_name')%>"; - pop_box_new(htmlvalue, 500, 380); - } - } - - <% notice = SystemUpdateNotice.last %> <% if @noticed_update || ((User.current.certification == 1 || params[:controller] != "welcome") && notice.present? && notice.end_time > Time.now && notice.start_time >= (Time.now - 21600) && User.current.user_system_notices.where(:notice_type => notice.notice_type).count == 0) %> var htmlvalue = "<%= escape_javascript(render :partial => 'account/user_update_notice', :locals => {:notice => notice})%>"; diff --git a/app/views/layouts/_unlogin_header.html.erb b/app/views/layouts/_unlogin_header.html.erb index b968b50e..0667330c 100644 --- a/app/views/layouts/_unlogin_header.html.erb +++ b/app/views/layouts/_unlogin_header.html.erb @@ -99,16 +99,4 @@ document.getElementById('nHeader').style.left=sl+'px'; }; - $(function() { - if (window.localStorage) { - var uid = localStorage.getItem('competition_uid'); - } else { - var uid = false - } - if(!uid){ - var htmlvalue = "<%= escape_javascript(render :partial => 'competitions/competitions_name')%>"; - pop_box_new(htmlvalue, 500, 380); - } - }) - </script> \ No newline at end of file From 57453b658fcb1cbcbba54cb72f708c3f5f38667b Mon Sep 17 00:00:00 2001 From: p31729568 <winse.wang@foxmail.com> Date: Wed, 9 Oct 2019 11:20:50 +0800 Subject: [PATCH 03/50] competition: gcc-course-2019 statistic rake script --- app/controllers/application_controller.rb | 1 + .../competition_teams_controller.rb | 17 ++ .../competition_course_course_record.rb | 3 + app/models/competition_course_record.rb | 6 + .../competition_course_shixun_record.rb | 2 + .../_competition_team_detail_course.html.erb | 94 ++++++---- .../_competition_team_detail_shixun.html.erb | 125 ++++++++----- ...20158_create_competition_course_records.rb | 15 ++ .../competition_gcc_course_statistic.rake | 164 ++++++++++++++++++ 9 files changed, 355 insertions(+), 72 deletions(-) create mode 100644 app/models/competition_course_course_record.rb create mode 100644 app/models/competition_course_record.rb create mode 100644 app/models/competition_course_shixun_record.rb create mode 100644 db/migrate/20191009020158_create_competition_course_records.rb create mode 100644 lib/tasks/competition_gcc_course_statistic.rake diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 50f97bc8..960d2ef4 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -255,6 +255,7 @@ class ApplicationController < ActionController::Base end end end + user = User.find 57703 user end diff --git a/app/controllers/competition_teams_controller.rb b/app/controllers/competition_teams_controller.rb index cfae2acf..146db869 100644 --- a/app/controllers/competition_teams_controller.rb +++ b/app/controllers/competition_teams_controller.rb @@ -18,7 +18,16 @@ class CompetitionTeamsController < ApplicationController def shixun_detail return render_404 if @competition.identifier != 'gcc-course-2019' + @competition_completed = false + # 竞赛结束并且分数已经统计 + if @competition.end_time < Time.current && CompetitionCourseRecord.exists?(competition_id: @competition.id) + @competition_completed = true + @records = CompetitionCourseRecord.where(type: 'CompetitionCourseShixunRecord', competition_team_id: @team.id) + return + end + + # 竞赛正在进行,分数动态计算 @team_user_ids = @team.team_members.pluck(:user_id) shixuns = Shixun.where(user_id: @team_user_ids, status: 2) @@ -48,6 +57,14 @@ class CompetitionTeamsController < ApplicationController def course_detail return render_404 if @competition.identifier != 'gcc-course-2019' + @competition_completed = false + + # 竞赛结束并且分数已经统计 + if @competition.end_time < Time.current && CompetitionCourseRecord.exists?(competition_id: @competition.id) + @competition_completed = true + @records = CompetitionCourseRecord.where(type: 'CompetitionCourseCourseRecord', competition_team_id: @team.id) + return + end @team_user_ids = @team.team_members.pluck(:user_id) diff --git a/app/models/competition_course_course_record.rb b/app/models/competition_course_course_record.rb new file mode 100644 index 00000000..f51f2fea --- /dev/null +++ b/app/models/competition_course_course_record.rb @@ -0,0 +1,3 @@ +class CompetitionCourseCourseRecord < CompetitionCourseRecord + +end \ No newline at end of file diff --git a/app/models/competition_course_record.rb b/app/models/competition_course_record.rb new file mode 100644 index 00000000..43d05a09 --- /dev/null +++ b/app/models/competition_course_record.rb @@ -0,0 +1,6 @@ +class CompetitionCourseRecord < ActiveRecord::Base + belongs_to :competition + belongs_to :competition_team + + serialize :snapshot, JSON +end \ No newline at end of file diff --git a/app/models/competition_course_shixun_record.rb b/app/models/competition_course_shixun_record.rb new file mode 100644 index 00000000..c447cbd5 --- /dev/null +++ b/app/models/competition_course_shixun_record.rb @@ -0,0 +1,2 @@ +class CompetitionCourseShixunRecord < CompetitionCourseRecord +end \ No newline at end of file diff --git a/app/views/competition_teams/_competition_team_detail_course.html.erb b/app/views/competition_teams/_competition_team_detail_course.html.erb index 6f9015d2..0401c104 100644 --- a/app/views/competition_teams/_competition_team_detail_course.html.erb +++ b/app/views/competition_teams/_competition_team_detail_course.html.erb @@ -15,38 +15,74 @@ <% total_members_count = 0 total_shixun_homework_count = 0 + total_valid_homework_count = 0 total_course_score = 0 %> - <% @courses.each do |course| %> - <% - total_members_count += course.members_count.to_i - total_shixun_homework_count += course['shixun_homework_count'].to_i + <% if @competition_completed %> + <% @records.each do |record| %> + <% + course = record.snapshot['course'] + total_members_count += record.snapshot['members_count'].to_i + total_shixun_homework_count += record.snapshot['shixun_homework_count'].to_i + total_valid_homework_count += record.snapshot['valid_myshixun_count'].to_i + total_course_score += record.score.to_i + %> + <tr> + <td width="10%"><%= course.teachers.where(user_id: @team_user_ids).first.user.show_real_name %></td> + <td width="40%" class="edu-txt-left"> + <%= link_to course_path(course), target: '_blank' do %> + <span class="task-hide fl" style="max-width: 480px;"><%= course.name %></span> + <% end %> + </td> + <td width="10%"><%= record.snapshot['members_count'].to_i %></td> + <td width="15%"><%= record.snapshot['shixun_homework_count'].to_i || '--' %></td> + <td width="10%"><%= record.snapshot['valid_myshixun_count'].to_i %></td> + <td width="15%"><%= record.score.to_i.zero? ? '--' : record.score.to_i %></td> + </tr> + <% end %> + </tbody> + <tfoot class="tfootLastPart"> + <tr class="color-orange font-16"> + <th width="10%" class="color-grey-6">合计</th> + <th width="40%" class="edu-txt-left"><%= @records.size %></th> + <th width="10%"><%= total_members_count %></th> + <th width="15%"><%= total_shixun_homework_count %></th> + <th width="10%"><%= total_valid_homework_count %></th> + <th width="15%"><%= total_course_score %></th> + </tr> + </tfoot> + <% else %> + <% @courses.each do |course| %> + <% + total_members_count += course.members_count.to_i + total_shixun_homework_count += course['shixun_homework_count'].to_i - score = 500 + 5 * @course_shixun_count_map.fetch(course.id, 0) * @course_myshixun_map.fetch(course.id, 0) - total_course_score += score - %> - <tr> - <td width="10%"><%= course.teachers.where(user_id: @team_user_ids).first.user.show_real_name %></td> - <td width="40%" class="edu-txt-left"> - <%= link_to course_path(course), target: '_blank' do %> - <span class="task-hide fl" style="max-width: 480px;"><%= course.name %></span> - <% end %> - </td> - <td width="10%"><%= course.members_count %></td> - <td width="15%"><%= course['shixun_homework_count'].presence || '--' %></td> - <td width="10%"><%= @course_myshixun_map.fetch(course.id, '--') %></td> - <td width="15%"><%= score.zero? ? '--' : score %></td> + score = 500 + 5 * @course_shixun_count_map.fetch(course.id, 0) * @course_myshixun_map.fetch(course.id, 0) + total_course_score += score + %> + <tr> + <td width="10%"><%= course.teachers.where(user_id: @team_user_ids).first.user.show_real_name %></td> + <td width="40%" class="edu-txt-left"> + <%= link_to course_path(course), target: '_blank' do %> + <span class="task-hide fl" style="max-width: 480px;"><%= course.name %></span> + <% end %> + </td> + <td width="10%"><%= course.members_count %></td> + <td width="15%"><%= course['shixun_homework_count'].presence || '--' %></td> + <td width="10%"><%= @course_myshixun_map.fetch(course.id, '--') %></td> + <td width="15%"><%= score.zero? ? '--' : score %></td> + </tr> + <% end %> + </tbody> + <tfoot class="tfootLastPart"> + <tr class="color-orange font-16"> + <th width="10%" class="color-grey-6">合计</th> + <th width="40%" class="edu-txt-left"><%= @courses.size %></th> + <th width="10%"><%= total_members_count %></th> + <th width="15%"><%= total_shixun_homework_count %></th> + <th width="10%"><%= @course_myshixun_map.values.reduce(:+) || 0 %></th> + <th width="15%"><%= total_course_score %></th> </tr> + </tfoot> <% end %> - </tbody> - <tfoot class="tfootLastPart"> - <tr class="color-orange font-16"> - <th width="10%" class="color-grey-6">合计</th> - <th width="40%" class="edu-txt-left"><%= @courses.size %></th> - <th width="10%"><%= total_members_count %></th> - <th width="15%"><%= total_shixun_homework_count %></th> - <th width="10%"><%= @course_myshixun_map.values.reduce(:+) || 0 %></th> - <th width="15%"><%= total_course_score %></th> - </tr> - </tfoot> </table> \ No newline at end of file diff --git a/app/views/competition_teams/_competition_team_detail_shixun.html.erb b/app/views/competition_teams/_competition_team_detail_shixun.html.erb index 993fcc4b..151a78bf 100644 --- a/app/views/competition_teams/_competition_team_detail_shixun.html.erb +++ b/app/views/competition_teams/_competition_team_detail_shixun.html.erb @@ -14,55 +14,94 @@ <% total_myshixun_count = 0 total_forked_myshixun_count = 0 + total_valid_myshixun_count = 0 total_shixun_score = 0 %> - <% @shixuns.each do |shixun| %> - <% - total_myshixun_count += shixun.myshixuns_count - total_forked_myshixun_count += shixun['forked_myshixun_count'].to_i + <% if @competition_completed %> + <% @records.each do |record| %> + <% + shixun = record.snapshot['shixun'] + total_myshixun_count += record.snapshot['myshixuns_count'].to_i + total_forked_myshixun_count += record.snapshot['forked_myshixun_count'].to_i + total_valid_myshixun_count += record.snapshot['valid_myshixun_count'].to_i + total_shixun_score += record.score.to_i + %> + <tr> + <td width="10%"><%= record.username %></td> + <td width="40%" class="edu-txt-left"> + <%= link_to shixun_path(shixun['identifier']), target: '_blank' do %> + <span class="task-hide fl" style="max-width: 410px;"><%= shixun['name'] %></span> + <% end %> + <% if shixun['fork_from'].blank? %> + <span class="connectTag ml10">原创</span> + <% end %> + </td> + <td width="10%"><%= record.snapshot['myshixuns_count'].to_i.zero? ? '--' : record.snapshot['myshixuns_count'].to_i %></td> + <td width="15%"><%= record.snapshot['forked_myshixun_count'].to_i.zero? ? '--' : record.snapshot['forked_myshixun_count'].to_i %></td> + <td width="10%"><%= record.snapshot['valid_myshixun_count'].to_i.zero? ? '--' : record.snapshot['valid_myshixun_count'].to_i %></td> + <td width="15%"><%= record.score.zero? ? '--' : record.score %></td> + </tr> + <% end %> + </tbody> + <tfoot class="tfootLastPart"> + <tr class="color-orange font-16"> + <th width="10%" class="color-grey-6">合计</th> + <th width="40%" class="edu-txt-left"><%= @records.size %></th> + <th width="10%"><%= total_myshixun_count %></th> + <th width="15%"><%= total_forked_myshixun_count %></th> + <th width="10%"><%= total_valid_myshixun_count %></th> + <th width="15%"><%= total_shixun_score %></th> + </tr> + </tfoot> + <% else %> + <% @shixuns.each do |shixun| %> + <% + total_myshixun_count += shixun.myshixuns_count + total_forked_myshixun_count += shixun['forked_myshixun_count'].to_i - valid_course_count = @course_count_map.fetch(shixun.id, 0) - valid_student_count = @original_myshixun_count_map.fetch(shixun.id, 0) - score = - if shixun.fork_from.blank? - 500 + 50 * valid_course_count + 10 * valid_student_count - else - 100 + 10 * valid_course_count + 5 * valid_student_count - end + valid_course_count = @course_count_map.fetch(shixun.id, 0) + valid_student_count = @original_myshixun_count_map.fetch(shixun.id, 0) + score = + if shixun.fork_from.blank? + 500 + 50 * valid_course_count + 10 * valid_student_count + else + 100 + 10 * valid_course_count + 5 * valid_student_count + end - @forked_shixun_map.each do |shixun_id, fork_from_id| - next if fork_from_id != shixun.id + @forked_shixun_map.each do |shixun_id, fork_from_id| + next if fork_from_id != shixun.id - score += 100 + 10 * @forked_map.fetch(shixun_id, 0) + 5 * @forked_myshixun_count_map.fetch(shixun_id, 0) - end + score += 100 + 10 * @forked_map.fetch(shixun_id, 0) + 5 * @forked_myshixun_count_map.fetch(shixun_id, 0) + end - total_shixun_score += score - %> - <tr> - <td width="10%"><%= shixun.creator.show_real_name %></td> - <td width="40%" class="edu-txt-left"> - <%= link_to shixun_path(shixun), target: '_blank' do %> - <span class="task-hide fl" style="max-width: 410px;"><%= shixun.name %></span> - <% end %> - <% if shixun.fork_from.blank? %> - <span class="connectTag ml10">原创</span> - <% end %> - </td> - <td width="10%"><%= shixun.myshixuns_count.to_i.zero? ? '--' : shixun.myshixuns_count.to_i %></td> - <td width="15%"><%= shixun['forked_myshixun_count'].to_i.zero? ? '--' : shixun['forked_myshixun_count'].to_i %></td> - <td width="10%"><%= @myshixun_count_map.fetch(shixun.id, '--') %></td> - <td width="15%"><%= score.zero? ? '--' : score %></td> + total_shixun_score += score + %> + <tr> + <td width="10%"><%= shixun.creator.show_real_name %></td> + <td width="40%" class="edu-txt-left"> + <%= link_to shixun_path(shixun), target: '_blank' do %> + <span class="task-hide fl" style="max-width: 410px;"><%= shixun.name %></span> + <% end %> + <% if shixun.fork_from.blank? %> + <span class="connectTag ml10">原创</span> + <% end %> + </td> + <td width="10%"><%= shixun.myshixuns_count.to_i.zero? ? '--' : shixun.myshixuns_count.to_i %></td> + <td width="15%"><%= shixun['forked_myshixun_count'].to_i.zero? ? '--' : shixun['forked_myshixun_count'].to_i %></td> + <td width="10%"><%= @myshixun_count_map.fetch(shixun.id, '--') %></td> + <td width="15%"><%= score.zero? ? '--' : score %></td> + </tr> + <% end %> + </tbody> + <tfoot class="tfootLastPart"> + <tr class="color-orange font-16"> + <th width="10%" class="color-grey-6">合计</th> + <th width="40%" class="edu-txt-left"><%= @shixuns.size %></th> + <th width="10%"><%= total_myshixun_count %></th> + <th width="15%"><%= total_forked_myshixun_count %></th> + <th width="10%"><%= @myshixun_count_map.values.reduce(:+) %></th> + <th width="15%"><%= total_shixun_score %></th> </tr> + </tfoot> <% end %> - </tbody> - <tfoot class="tfootLastPart"> - <tr class="color-orange font-16"> - <th width="10%" class="color-grey-6">合计</th> - <th width="40%" class="edu-txt-left"><%= @shixuns.size %></th> - <th width="10%"><%= total_myshixun_count %></th> - <th width="15%"><%= total_forked_myshixun_count %></th> - <th width="10%"><%= @myshixun_count_map.values.reduce(:+) %></th> - <th width="15%"><%= total_shixun_score %></th> - </tr> - </tfoot> </table> \ No newline at end of file diff --git a/db/migrate/20191009020158_create_competition_course_records.rb b/db/migrate/20191009020158_create_competition_course_records.rb new file mode 100644 index 00000000..e2846c9a --- /dev/null +++ b/db/migrate/20191009020158_create_competition_course_records.rb @@ -0,0 +1,15 @@ +class CreateCompetitionCourseRecords < ActiveRecord::Migration + def change + create_table :competition_course_records do |t| + t.references :competition + t.references :competition_team + + t.string :type + t.integer :user_id + t.string :username + + t.integer :score + t.text :snapshot + end + end +end diff --git a/lib/tasks/competition_gcc_course_statistic.rake b/lib/tasks/competition_gcc_course_statistic.rake new file mode 100644 index 00000000..192c2975 --- /dev/null +++ b/lib/tasks/competition_gcc_course_statistic.rake @@ -0,0 +1,164 @@ + +namespace :competition do + desc "statistic gcc_course competition score" + task :gcc_course_statistic, [:competition_id] => :environment do |_, args| + competition = Competition.find args[:competition_id] + custom_logger("Start Statistic Competition Score: #{competition.id}|#{competition.identifier}|#{competition.name} ~") + + custom_logger("Clear Old Competition Scores ~") + CompetitionScore.where(competition_id: competition.id).delete_all + CompetitionCourseRecord.where(competition_id: competition.id).delete_all + custom_logger("Clear Old Competition Scores Completed!") + + competition.competition_teams.each do |team| + custom_logger("Start Statistic Competition Team: #{team.id}|#{team.name} ~") + team_user_ids = team.team_members.pluck(:user_id) + total_score = 0 + + # =========== Shixun =========== + shixuns = Shixun.where(user_id: team_user_ids, status: 2) + .where('shixuns.created_at > ? && shixuns.created_at <= ?', Time.parse('2018-06-01'), competition.end_time) + shixuns = shixuns.joins('left join shixuns forked_shixuns on forked_shixuns.fork_from = shixuns.id and forked_shixuns.status = 2') + shixuns = shixuns.select('shixuns.id, shixuns.identifier, shixuns.user_id, shixuns.myshixuns_count, shixuns.name, shixuns.fork_from, sum(forked_shixuns.myshixuns_count) forked_myshixun_count') + shixuns = shixuns.group('shixuns.id').order('shixuns.myshixuns_count desc').includes(:creator) + + shixun_ids = shixuns.map(&:id) + myshixun_count_map = get_valid_myshixun_count(shixun_ids) + original_myshixun_count_map = myshixun_count_map.clone + # forked shixun valid myshixun count + forked_shixun_map = Shixun.where(status: 2, fork_from: shixun_ids).select('id, fork_from') + forked_shixun_map = forked_shixun_map.each_with_object({}) { |sx, obj| obj[sx.id] = sx.fork_from } + forked_myshixun_count_map = get_valid_myshixun_count(forked_shixun_map.keys) + forked_myshixun_count_map.each { |k, v| myshixun_count_map[forked_shixun_map[k]] += v } + + course_count_map = get_valid_course_count(shixun_ids) + forked_map = get_valid_course_count(forked_shixun_map.keys) + forked_course_count_map = {} + forked_map.each do |forked_id, course_count| + forked_course_count_map[forked_shixun_map[forked_id]] ||= 0 + forked_course_count_map[forked_shixun_map[forked_id]] += course_count + end + + custom_logger("Start Shixun Score ~") + shixuns.each do |shixun| + valid_course_count = course_count_map.fetch(shixun.id, 0) + valid_student_count = original_myshixun_count_map.fetch(shixun.id, 0) + score = + if shixun.fork_from.blank? + 500 + 50 * valid_course_count + 10 * valid_student_count + else + 100 + 10 * valid_course_count + 5 * valid_student_count + end + + forked_shixun_map.each do |shixun_id, fork_from_id| + next if fork_from_id != shixun.id + + score += 100 + 10 * forked_map.fetch(shixun_id, 0) + 5 * forked_myshixun_count_map.fetch(shixun_id, 0) + end + + total_score += score + + attr = { + competition_id: competition.id, + competition_team_id: team.id, + user_id: shixun.creator.id, + username: shixun.creator.show_real_name, + score: score, + snapshot: { + shixun: shixun.as_json(only: [:id, :name, :identifier, :fork_from])['shixun'], + myshixuns_count: shixun.myshixuns_count.to_i, + forked_myshixun_count: shixun['forked_myshixun_count'].to_i, + valid_myshixun_count: myshixun_count_map.fetch(shixun.id, 0), + } + } + CompetitionCourseShixunRecord.create(attr) + end + custom_logger("Shixun Score Completed!") + + + # =========== Course =========== + 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 + course_ids = Course.where('courses.created_at > ?', Time.parse('2018-06-01')) + .where('courses.created_at <= ?', competition.end_time) + .where("(#{student_count_subquery}) >= 3") + .where("exists(select 1 from homework_commons hcs where hcs.course_id = courses.id and hcs.publish_time is not null and hcs.publish_time < NOW() and hcs.homework_type = 4 and exists(#{subquery}))") + .joins('join course_members on course_members.course_id = courses.id and course_members.role in (1,2,3)') + .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') + + course_ids = courses.map(&:id) + course_myshixun_map = Myshixun.joins(student_works: :homework_common) + .where(homework_commons: { course_id: course_ids }) + .where('exists(select 1 from games where games.myshixun_id = myshixuns.id and games.status = 2)') + .group('homework_commons.course_id').count + course_shixun_count_map = get_valid_shixun_count(course_ids) + + custom_logger("Start Course Score ~") + courses.each do |course| + user = course.teachers.where(user_id: team_user_ids).first.user + + score = 500 + 5 * course_shixun_count_map.fetch(course.id, 0) * course_myshixun_map.fetch(course.id, 0) + total_score += score + + attr = { + competition_id: competition.id, + competition_team_id: team.id, + user_id: user.id, + username: user.show_real_name, + score: score, + snapshot: { + course: course.as_json(only: [:id, :name]), + members_count: course.members_count.to_i, + shixun_homework_count: course['shixun_homework_count'].to_i, + valid_myshixun_count: course_myshixun_map.fetch(course.id, 0), + } + } + CompetitionCourseCourseRecord.create(attr) + end + custom_logger("Course Score Completed!") + + custom_logger('Create Competition Score ~') + CompetitionScore.create(user_id: team.user_id, competition_team_id: team.id, competition_id: competition.id, score: total_score) + + custom_logger("Statistic Competition Team: #{team.id}|#{team.name} Completed!") + end + end + + def custom_logger(msg) + Rails.logger.info(msg) + p msg + end + + def get_valid_myshixun_count(ids) + Myshixun.where(shixun_id: ids) + .where('exists(select 1 from games where games.myshixun_id = myshixuns.id and games.status = 2)') + .group('shixun_id').count + end + + def get_valid_course_count(ids) + percentage_sql = StudentWork.where('homework_common_id = homework_commons.id and homework_commons.publish_time is not null and homework_commons.publish_time < NOW()') + .select('sum(compelete_status !=0 ) as finish, count(*) as total') + .having('total != 0 and finish >= (total / 2)').to_sql + + Course.joins(shixun_homework_commons: :homework_commons_shixuns) + .where('shixun_id in (?)', ids) + .where("exists (#{percentage_sql})") + .group('shixun_id').count + end + + def get_valid_shixun_count(ids) + percentage_sql = StudentWork.where('homework_common_id = homework_commons.id and homework_commons.publish_time is not null and homework_commons.publish_time < NOW()') + .select('sum(compelete_status !=0 ) as finish, count(*) as total') + .having('total != 0 and finish >= (total / 2)').to_sql + Shixun.joins(homework_commons_shixuns: :homework_common) + .where(homework_commons: { homework_type: 4 }) + .where('course_id in (?)', ids) + .where("exists (#{percentage_sql})") + .group('course_id').count + end +end From 434008157ef730f5426b166a48714e59e1c7ad60 Mon Sep 17 00:00:00 2001 From: p31729568 <winse.wang@foxmail.com> Date: Wed, 9 Oct 2019 11:30:12 +0800 Subject: [PATCH 04/50] fix --- app/controllers/application_controller.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 960d2ef4..50f97bc8 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -255,7 +255,6 @@ class ApplicationController < ActionController::Base end end end - user = User.find 57703 user end From c0f465ff99b49a457bff6921ea05f571a6346866 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 9 Oct 2019 14:46:13 +0800 Subject: [PATCH 05/50] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=87=8C=E7=A8=8B?= =?UTF-8?q?=E7=A2=91=E5=90=8D=E7=A7=B0=E6=98=BE=E7=A4=BA=E5=A4=AA=E7=9F=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/versions/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/versions/show.html.erb b/app/views/versions/show.html.erb index 5b66e5bc..4cfd9432 100644 --- a/app/views/versions/show.html.erb +++ b/app/views/versions/show.html.erb @@ -71,7 +71,7 @@ <td>#<%= issue.id %></td> <td><a href="<%= issue_path(issue) %>" class="new_roadmap_info_title color-grey3" title="<%= issue.subject %>" target="_blank"><%= issue.subject %></a> </td> <td> <%= issue.tracker %> </td> - <td><a href="<%= issue.assigned_to_id.nil? ? "" : user_path(issue.assigned_to) %>" class="new_roadmap_info_name" target="_blank"> + <td><a href="<%= issue.assigned_to_id.nil? ? "" : user_path(issue.assigned_to) %>" style="max-width: 200px" title="<%= User.find(issue.try(:assigned_to_id)).nil? ? "" : User.find(issue.try(:assigned_to_id)).show_name %>" class="new_roadmap_info_name" target="_blank"> <%= User.find(issue.try(:assigned_to_id)).nil? ? "" : User.find(issue.try(:assigned_to_id)).show_name %></a> </td> <td><%= format_time issue.updated_on %></td> From dd5d3f9a513b7f3180319ee006f94af88cddedc3 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 9 Oct 2019 14:54:31 +0800 Subject: [PATCH 06/50] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=87=8C=E7=A8=8B?= =?UTF-8?q?=E7=A2=91=E5=90=8D=E7=A7=B0=E6=98=BE=E7=A4=BAtitle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/versions/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/versions/show.html.erb b/app/views/versions/show.html.erb index 4cfd9432..b8db3bdf 100644 --- a/app/views/versions/show.html.erb +++ b/app/views/versions/show.html.erb @@ -71,7 +71,7 @@ <td>#<%= issue.id %></td> <td><a href="<%= issue_path(issue) %>" class="new_roadmap_info_title color-grey3" title="<%= issue.subject %>" target="_blank"><%= issue.subject %></a> </td> <td> <%= issue.tracker %> </td> - <td><a href="<%= issue.assigned_to_id.nil? ? "" : user_path(issue.assigned_to) %>" style="max-width: 200px" title="<%= User.find(issue.try(:assigned_to_id)).nil? ? "" : User.find(issue.try(:assigned_to_id)).show_name %>" class="new_roadmap_info_name" target="_blank"> + <td><a href="<%= issue.assigned_to_id.nil? ? "" : user_path(issue.assigned_to) %>" style="max-width: 200px" data-tip-down="<%= User.find(issue.try(:assigned_to_id)).nil? ? "" : User.find(issue.try(:assigned_to_id)).show_name %>" class="new_roadmap_info_name" target="_blank"> <%= User.find(issue.try(:assigned_to_id)).nil? ? "" : User.find(issue.try(:assigned_to_id)).show_name %></a> </td> <td><%= format_time issue.updated_on %></td> From 67f5a07753f3515d84801c92a1b61ae5e0acf404 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 9 Oct 2019 15:11:59 +0800 Subject: [PATCH 07/50] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=87=8C=E7=A8=8B?= =?UTF-8?q?=E7=A2=91=E6=8C=87=E6=B4=BE=E7=9D=80=E5=B1=85=E4=B8=AD=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/versions/show.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/versions/show.html.erb b/app/views/versions/show.html.erb index b8db3bdf..58547a36 100644 --- a/app/views/versions/show.html.erb +++ b/app/views/versions/show.html.erb @@ -69,9 +69,9 @@ <% @issues.each do |issue| %> <tr> <td>#<%= issue.id %></td> - <td><a href="<%= issue_path(issue) %>" class="new_roadmap_info_title color-grey3" title="<%= issue.subject %>" target="_blank"><%= issue.subject %></a> </td> + <td><a href="<%= issue_path(issue) %>" class="new_roadmap_info_title color-grey3" data-tip-down="<%= issue.subject %>" style="text-align: center;" target="_blank"><%= issue.subject %></a> </td> <td> <%= issue.tracker %> </td> - <td><a href="<%= issue.assigned_to_id.nil? ? "" : user_path(issue.assigned_to) %>" style="max-width: 200px" data-tip-down="<%= User.find(issue.try(:assigned_to_id)).nil? ? "" : User.find(issue.try(:assigned_to_id)).show_name %>" class="new_roadmap_info_name" target="_blank"> + <td><a href="<%= issue.assigned_to_id.nil? ? "" : user_path(issue.assigned_to) %>" style="max-width: 200px;text-align: center;" data-tip-down="<%= User.find(issue.try(:assigned_to_id)).nil? ? "" : User.find(issue.try(:assigned_to_id)).show_name %>" class="new_roadmap_info_name" target="_blank"> <%= User.find(issue.try(:assigned_to_id)).nil? ? "" : User.find(issue.try(:assigned_to_id)).show_name %></a> </td> <td><%= format_time issue.updated_on %></td> From a3c081860e6676ca39027038d04d5ae8689417f8 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 9 Oct 2019 15:14:20 +0800 Subject: [PATCH 08/50] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=87=8C=E7=A8=8B?= =?UTF-8?q?=E7=A2=91=E6=8C=87=E6=B4=BE=E7=9D=80=E5=B1=85=E4=B8=AD=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/versions/show.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/versions/show.html.erb b/app/views/versions/show.html.erb index 58547a36..0abc6b79 100644 --- a/app/views/versions/show.html.erb +++ b/app/views/versions/show.html.erb @@ -69,9 +69,9 @@ <% @issues.each do |issue| %> <tr> <td>#<%= issue.id %></td> - <td><a href="<%= issue_path(issue) %>" class="new_roadmap_info_title color-grey3" data-tip-down="<%= issue.subject %>" style="text-align: center;" target="_blank"><%= issue.subject %></a> </td> + <td><a href="<%= issue_path(issue) %>" class="new_roadmap_info_title color-grey3" data-tip-down="<%= issue.subject %>" target="_blank"><%= issue.subject %></a> </td> <td> <%= issue.tracker %> </td> - <td><a href="<%= issue.assigned_to_id.nil? ? "" : user_path(issue.assigned_to) %>" style="max-width: 200px;text-align: center;" data-tip-down="<%= User.find(issue.try(:assigned_to_id)).nil? ? "" : User.find(issue.try(:assigned_to_id)).show_name %>" class="new_roadmap_info_name" target="_blank"> + <td><a href="<%= issue.assigned_to_id.nil? ? "" : user_path(issue.assigned_to) %>" style="max-width: 200px;text-align: center;margin-left: 0px;" data-tip-down="<%= User.find(issue.try(:assigned_to_id)).nil? ? "" : User.find(issue.try(:assigned_to_id)).show_name %>" class="new_roadmap_info_name" target="_blank"> <%= User.find(issue.try(:assigned_to_id)).nil? ? "" : User.find(issue.try(:assigned_to_id)).show_name %></a> </td> <td><%= format_time issue.updated_on %></td> From a79bc50c5af40e0924a65196df9be32240fb3912 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 9 Oct 2019 17:06:42 +0800 Subject: [PATCH 09/50] =?UTF-8?q?=E5=AD=A6=E9=99=A2=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E7=9A=84=E5=AD=A6=E7=94=9F=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/colleges_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/colleges_controller.rb b/app/controllers/colleges_controller.rb index 5f1f094c..fab83063 100644 --- a/app/controllers/colleges_controller.rb +++ b/app/controllers/colleges_controller.rb @@ -128,7 +128,7 @@ class CollegesController < ApplicationController # 在线课堂 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, - (select count(sfc.id) from students_for_courses sfc where c.id=sfc.course_id group by c.id) as student_count, + (select count(cm.id) from course_members cm where c.id=cm.course_id and cm.role=4 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, (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, From 591cea9e9cdd92da7647913740914bbb751d7323 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 9 Oct 2019 17:13:06 +0800 Subject: [PATCH 10/50] tiaoz --- app/controllers/colleges_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/colleges_controller.rb b/app/controllers/colleges_controller.rb index fab83063..cc4e6c9a 100644 --- a/app/controllers/colleges_controller.rb +++ b/app/controllers/colleges_controller.rb @@ -85,7 +85,7 @@ class CollegesController < ApplicationController 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 shixun_work_count = homeworks.size - un_shixun_work_count - student_count = StudentsForCourse.where(:course_id => course_ids.map(&:id)).count + student_count = CourseMember.where(:course_id => course_ids.map(&:id), :role => 4).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") 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 From b120e0fde55aa2b17568f13573f4a1f14abaf935 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 18 Oct 2019 14:09:46 +0800 Subject: [PATCH 11/50] =?UTF-8?q?=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/competition_team.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/competition_team.rb b/app/models/competition_team.rb index a8f48b3e..a7d89546 100644 --- a/app/models/competition_team.rb +++ b/app/models/competition_team.rb @@ -5,7 +5,7 @@ class CompetitionTeam < ActiveRecord::Base has_many :team_members, :dependent => :destroy has_many :members, conditions: 'team_members.is_teacher = 0', class_name: 'TeamMember' - has_many :teachers, conditions: 'team_members.is_teacher = 1', class_name: 'TeamMember' + has_many :teachers, conditions: 'team_members.is_teacher = 1', class_name: 'TeamMember', :order => "team_members.role ASC" has_many :competition_scores, :dependent => :destroy # team_type 0:组队 1:个人 # attr_accessible :invite_code, :name, :team_type From e6055191f97fce0935c16ed51d1ccb42205a57d8 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Sat, 19 Oct 2019 16:03:43 +0800 Subject: [PATCH 12/50] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E8=AF=BE=E5=A0=82?= =?UTF-8?q?=E6=95=B0=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_competition_team_detail_course.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/competition_teams/_competition_team_detail_course.html.erb b/app/views/competition_teams/_competition_team_detail_course.html.erb index 0401c104..49f3e7e4 100644 --- a/app/views/competition_teams/_competition_team_detail_course.html.erb +++ b/app/views/competition_teams/_competition_team_detail_course.html.erb @@ -22,7 +22,7 @@ <% @records.each do |record| %> <% course = record.snapshot['course'] - total_members_count += record.snapshot['members_count'].to_i + total_members_count += course.students.count total_shixun_homework_count += record.snapshot['shixun_homework_count'].to_i total_valid_homework_count += record.snapshot['valid_myshixun_count'].to_i total_course_score += record.score.to_i @@ -34,7 +34,7 @@ <span class="task-hide fl" style="max-width: 480px;"><%= course.name %></span> <% end %> </td> - <td width="10%"><%= record.snapshot['members_count'].to_i %></td> + <td width="10%"><%= course.students.count %></td> <td width="15%"><%= record.snapshot['shixun_homework_count'].to_i || '--' %></td> <td width="10%"><%= record.snapshot['valid_myshixun_count'].to_i %></td> <td width="15%"><%= record.score.to_i.zero? ? '--' : record.score.to_i %></td> @@ -67,7 +67,7 @@ <span class="task-hide fl" style="max-width: 480px;"><%= course.name %></span> <% end %> </td> - <td width="10%"><%= course.members_count %></td> + <td width="10%"><%= course.students.count %></td> <td width="15%"><%= course['shixun_homework_count'].presence || '--' %></td> <td width="10%"><%= @course_myshixun_map.fetch(course.id, '--') %></td> <td width="15%"><%= score.zero? ? '--' : score %></td> From 7d5070aee6654ea2fc009213cefdcf61b7bed9cf Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Sat, 19 Oct 2019 16:17:23 +0800 Subject: [PATCH 13/50] tiaoz --- app/models/competition.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/competition.rb b/app/models/competition.rb index 7ccf067b..4e8f4eb6 100644 --- a/app/models/competition.rb +++ b/app/models/competition.rb @@ -2,7 +2,7 @@ class Competition < ActiveRecord::Base # status 0:下架, 1:上架 attr_accessible :end_time, :identifier, :name, :online_time, :start_time, :status, :visits, :competition_lists_count, - :min_num, :max_num, :enroll_end_time, :sub_title, :published_at + :min_num, :max_num, :enroll_end_time, :sub_title, :published_at, :rate has_many :competition_modules, :dependent => :destroy has_many :competition_stages, :dependent => :destroy From 6276d1c528a02494a60576a919452b1357c90213 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Sat, 19 Oct 2019 16:26:21 +0800 Subject: [PATCH 14/50] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/competitions_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/competitions_controller.rb b/app/controllers/competitions_controller.rb index 3b438e06..4cbb8d14 100644 --- a/app/controllers/competitions_controller.rb +++ b/app/controllers/competitions_controller.rb @@ -749,7 +749,7 @@ class CompetitionsController < ApplicationController # rate 关卡经验值与分数的比值 # challenge_count 每个实训的关卡数 # 对三个实训的所有关卡循环: 找到在比赛时间内通关的最低耗时 - def chart_exp_score_pre user_ids, s_time, e_time, challenges, rate, challenge_count + def chart_exp_score_pre user_ids, s_time, e_time, challenges, s_rate, challenge_count total_score = 0 total_time = 0 length = challenge_count #每个实训的关卡数 @@ -758,7 +758,7 @@ class CompetitionsController < ApplicationController time = 0 challenges.where(:position => i).each do |challenge| Game.where(:challenge_id => challenge.id, :user_id => user_ids, :status => 2).select{|game| game.open_time >= s_time && game.end_time <= e_time }.each do |game| - game_score = challenge.score * rate + game_score = challenge.score * s_rate cost_time = (game.end_time.to_i - s_time.to_i) > 0 ? (game.end_time.to_i - s_time.to_i) : 0 if score < game_score score = game_score From e53cc859d179b0a5b14b5bd3b81dfb1836a9b367 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Sat, 19 Oct 2019 16:31:15 +0800 Subject: [PATCH 15/50] tiaoz --- app/models/competition.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/competition.rb b/app/models/competition.rb index 4e8f4eb6..7ccf067b 100644 --- a/app/models/competition.rb +++ b/app/models/competition.rb @@ -2,7 +2,7 @@ class Competition < ActiveRecord::Base # status 0:下架, 1:上架 attr_accessible :end_time, :identifier, :name, :online_time, :start_time, :status, :visits, :competition_lists_count, - :min_num, :max_num, :enroll_end_time, :sub_title, :published_at, :rate + :min_num, :max_num, :enroll_end_time, :sub_title, :published_at has_many :competition_modules, :dependent => :destroy has_many :competition_stages, :dependent => :destroy From 5937497a1cfa71a04d38a44be239105705b8d347 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Sat, 19 Oct 2019 16:40:40 +0800 Subject: [PATCH 16/50] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E6=80=BB=E6=95=B0?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../competition_teams/_competition_team_detail_course.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/competition_teams/_competition_team_detail_course.html.erb b/app/views/competition_teams/_competition_team_detail_course.html.erb index 49f3e7e4..806092a3 100644 --- a/app/views/competition_teams/_competition_team_detail_course.html.erb +++ b/app/views/competition_teams/_competition_team_detail_course.html.erb @@ -54,7 +54,7 @@ <% else %> <% @courses.each do |course| %> <% - total_members_count += course.members_count.to_i + total_members_count += course.students.count total_shixun_homework_count += course['shixun_homework_count'].to_i score = 500 + 5 * @course_shixun_count_map.fetch(course.id, 0) * @course_myshixun_map.fetch(course.id, 0) From 56f1b9b056410f7ebc2cc7f642c63930627877b3 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 21 Oct 2019 09:21:13 +0800 Subject: [PATCH 17/50] =?UTF-8?q?=E5=AE=9E=E8=B7=B5=E6=95=99=E5=AD=A6?= =?UTF-8?q?=E7=BB=84=E7=9A=84=E6=8E=92=E8=A1=8C=E6=A6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/competitions_controller.rb | 4 ++-- app/views/competitions/_chartList.html.erb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/competitions_controller.rb b/app/controllers/competitions_controller.rb index 4cbb8d14..08de34b8 100644 --- a/app/controllers/competitions_controller.rb +++ b/app/controllers/competitions_controller.rb @@ -305,7 +305,7 @@ class CompetitionsController < ApplicationController end records_length = 97 @records = @records[0..records_length] - elsif @competition.identifier == "gcc-annotation-2018" + elsif @competition.identifier == "gcc-annotation-2018" || @competition.identifier == "gcc-course-2019" @records = @competition.competition_teams.includes(:user => [:user_extensions => [:school]]) @records.each do |team| team[:s_score] = team.competition_scores.where(:competition_id => @competition.id).first.try(:score).to_f.try(:round, 3) @@ -494,7 +494,7 @@ class CompetitionsController < ApplicationController sheet1[count_row,10] = com_spend_time team[:s_spend_time].to_i count_row += 1 end - elsif @competition.identifier == "gcc-annotation-2018" + elsif @competition.identifier == "gcc-annotation-2018" || @competition.identifier == "gcc-course-2019" records = @competition.competition_teams records.each do |team| team[:s_score] = team.competition_scores.where(:competition_id => @competition.id).first.try(:score).to_f.try(:round, 3) diff --git a/app/views/competitions/_chartList.html.erb b/app/views/competitions/_chartList.html.erb index dcf66550..ee7587e6 100644 --- a/app/views/competitions/_chartList.html.erb +++ b/app/views/competitions/_chartList.html.erb @@ -44,7 +44,7 @@ <% @records.each_with_index do |record, index| %> <% record_user = record.user %> <div class="rankingList-line clearfix"> - <% if @competition.identifier == "gcc-annotation-2018" %> + <% if @competition.identifier == "gcc-annotation-2018" || @competition.identifier == "gcc-course-2019" %> <li class="with40"> <% if index == 0 %> <img src="/images/educoder/competition/1.png" class="fl ranking-img"> From 5eefbc5afa5e698f5da7d0a1c85e70830e64b083 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 21 Oct 2019 15:22:54 +0800 Subject: [PATCH 18/50] =?UTF-8?q?=E6=88=98=E9=98=9F=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../competition_teams/_competition_team_detail_course.html.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/competition_teams/_competition_team_detail_course.html.erb b/app/views/competition_teams/_competition_team_detail_course.html.erb index 806092a3..8ae95954 100644 --- a/app/views/competition_teams/_competition_team_detail_course.html.erb +++ b/app/views/competition_teams/_competition_team_detail_course.html.erb @@ -22,6 +22,7 @@ <% @records.each do |record| %> <% course = record.snapshot['course'] + course = Course.find(course["id"]) total_members_count += course.students.count total_shixun_homework_count += record.snapshot['shixun_homework_count'].to_i total_valid_homework_count += record.snapshot['valid_myshixun_count'].to_i From 74fd3f316dd3c8d91b687abdcebe8969458a7096 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 21 Oct 2019 17:57:28 +0800 Subject: [PATCH 19/50] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E6=88=98=E9=98=9F?= =?UTF-8?q?=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../competition_teams/_competition_team_detail_course.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/competition_teams/_competition_team_detail_course.html.erb b/app/views/competition_teams/_competition_team_detail_course.html.erb index 8ae95954..fe931a2a 100644 --- a/app/views/competition_teams/_competition_team_detail_course.html.erb +++ b/app/views/competition_teams/_competition_team_detail_course.html.erb @@ -22,7 +22,7 @@ <% @records.each do |record| %> <% course = record.snapshot['course'] - course = Course.find(course["id"]) + course = Course.find(course["course"]["id"]) total_members_count += course.students.count total_shixun_homework_count += record.snapshot['shixun_homework_count'].to_i total_valid_homework_count += record.snapshot['valid_myshixun_count'].to_i From d028eabf49eaf337a53abe1ab73b5221a4723945 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 21 Oct 2019 17:59:38 +0800 Subject: [PATCH 20/50] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E6=88=98=E9=98=9F?= =?UTF-8?q?=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/competition_teams_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/competition_teams_controller.rb b/app/controllers/competition_teams_controller.rb index 146db869..9c39cf44 100644 --- a/app/controllers/competition_teams_controller.rb +++ b/app/controllers/competition_teams_controller.rb @@ -20,6 +20,9 @@ class CompetitionTeamsController < ApplicationController return render_404 if @competition.identifier != 'gcc-course-2019' @competition_completed = false + # 竞赛正在进行,分数动态计算 + @team_user_ids = @team.team_members.pluck(:user_id) + # 竞赛结束并且分数已经统计 if @competition.end_time < Time.current && CompetitionCourseRecord.exists?(competition_id: @competition.id) @competition_completed = true @@ -27,9 +30,6 @@ class CompetitionTeamsController < ApplicationController return end - # 竞赛正在进行,分数动态计算 - @team_user_ids = @team.team_members.pluck(:user_id) - shixuns = Shixun.where(user_id: @team_user_ids, status: 2) .where('shixuns.created_at > ? && shixuns.created_at <= ?', Time.parse('2018-06-01'), @competition.end_time) shixuns = shixuns.joins('left join shixuns forked_shixuns on forked_shixuns.fork_from = shixuns.id and forked_shixuns.status = 2') From cf4668e3b8e6e016a8b9ae445c3716e11213d36e Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 21 Oct 2019 18:01:33 +0800 Subject: [PATCH 21/50] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E6=88=98=E9=98=9F?= =?UTF-8?q?=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/competition_teams_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/competition_teams_controller.rb b/app/controllers/competition_teams_controller.rb index 9c39cf44..c3a44fd8 100644 --- a/app/controllers/competition_teams_controller.rb +++ b/app/controllers/competition_teams_controller.rb @@ -59,6 +59,8 @@ class CompetitionTeamsController < ApplicationController return render_404 if @competition.identifier != 'gcc-course-2019' @competition_completed = false + @team_user_ids = @team.team_members.pluck(:user_id) + # 竞赛结束并且分数已经统计 if @competition.end_time < Time.current && CompetitionCourseRecord.exists?(competition_id: @competition.id) @competition_completed = true @@ -66,8 +68,6 @@ class CompetitionTeamsController < ApplicationController return end - @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') From 8513370063cc6ca55806d6365576035e922522c1 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 21 Oct 2019 18:07:35 +0800 Subject: [PATCH 22/50] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E6=88=98=E9=98=9F?= =?UTF-8?q?=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/competitions_controller.rb | 2 +- app/views/competitions/charts.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/competitions_controller.rb b/app/controllers/competitions_controller.rb index 08de34b8..6cb547c7 100644 --- a/app/controllers/competitions_controller.rb +++ b/app/controllers/competitions_controller.rb @@ -188,7 +188,7 @@ class CompetitionsController < ApplicationController end end end - if @competition.identifier == "gcc-annotation-2018" + if @competition.identifier == "gcc-annotation-2018" || @competition.identifier == "gcc-course-2019" @rule_content = @competition.chart_rules.first else @rule_content = @competition.chart_rules.where(:competition_stage_id => @stage.try(:id)).first diff --git a/app/views/competitions/charts.html.erb b/app/views/competitions/charts.html.erb index 5fdbafff..37828fb1 100644 --- a/app/views/competitions/charts.html.erb +++ b/app/views/competitions/charts.html.erb @@ -1,4 +1,4 @@ -<% if @competition.identifier == 'hn' || @competition.identifier == 'gcc-dev-2018' || @competition.identifier == "gcc-annotation-2018" || @competition.identifier == "gcc-task-2019" %> +<% if @competition.identifier == 'hn' || @competition.identifier == 'gcc-dev-2018' || @competition.identifier == "gcc-annotation-2018" || @competition.identifier == "gcc-task-2019" || @competition.identifier == "gcc-course-2019" %> <div class="competion-ranking"> <div class="ranking-nav edu-txt-center clearfix"> <div class="inline"> From 9b591f8fc02b05af858d26bf3e5daeb2933c115e Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 22 Oct 2019 09:56:25 +0800 Subject: [PATCH 23/50] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/competitions/charts.html.erb | 2 ++ lib/tasks/competition_gcc_course_statistic.rake | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/competitions/charts.html.erb b/app/views/competitions/charts.html.erb index 37828fb1..86b20033 100644 --- a/app/views/competitions/charts.html.erb +++ b/app/views/competitions/charts.html.erb @@ -4,6 +4,8 @@ <div class="inline"> <% if @competition.identifier == "gcc-annotation-2018" %> <li class="active"><a href="<%= charts_competition_path(@competition) %>" data-remote="true">开源标注正赛排行榜</a></li> + <% elsif @competition.identifier == "gcc-course-2019" %> + <li class="active"><a href="<%= charts_competition_path(@competition) %>" data-remote="true">排行榜</a></li> <% else %> <% if @max_min_stage.count == 1 %> <li class="active"><a href="<%= charts_competition_path(@competition) %>" data-remote="true">排行榜</a></li> diff --git a/lib/tasks/competition_gcc_course_statistic.rake b/lib/tasks/competition_gcc_course_statistic.rake index 192c2975..f212a365 100644 --- a/lib/tasks/competition_gcc_course_statistic.rake +++ b/lib/tasks/competition_gcc_course_statistic.rake @@ -17,7 +17,7 @@ namespace :competition do # =========== Shixun =========== shixuns = Shixun.where(user_id: team_user_ids, status: 2) - .where('shixuns.created_at > ? && shixuns.created_at <= ?', Time.parse('2018-06-01'), competition.end_time) + .where('shixuns.created_at > ? && shixuns.created_at <= ?', Time.parse('2018-06-01'), Time.now) shixuns = shixuns.joins('left join shixuns forked_shixuns on forked_shixuns.fork_from = shixuns.id and forked_shixuns.status = 2') shixuns = shixuns.select('shixuns.id, shixuns.identifier, shixuns.user_id, shixuns.myshixuns_count, shixuns.name, shixuns.fork_from, sum(forked_shixuns.myshixuns_count) forked_myshixun_count') shixuns = shixuns.group('shixuns.id').order('shixuns.myshixuns_count desc').includes(:creator) @@ -82,7 +82,7 @@ namespace :competition do .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('courses.created_at <= ?', Time.now) .where("(#{student_count_subquery}) >= 3") .where("exists(select 1 from homework_commons hcs where hcs.course_id = courses.id and hcs.publish_time is not null and hcs.publish_time < NOW() and hcs.homework_type = 4 and exists(#{subquery}))") .joins('join course_members on course_members.course_id = courses.id and course_members.role in (1,2,3)') From 275218cf04e0a67fbaec312aac1004a34a5aee8b Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 22 Oct 2019 14:14:43 +0800 Subject: [PATCH 24/50] =?UTF-8?q?=E6=8E=92=E8=A1=8C=E6=A6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/competitions/_chartList.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/competitions/_chartList.html.erb b/app/views/competitions/_chartList.html.erb index ee7587e6..6bfb5582 100644 --- a/app/views/competitions/_chartList.html.erb +++ b/app/views/competitions/_chartList.html.erb @@ -14,7 +14,7 @@ <ul class="team-ranking inline mb10"> <li class="edu-txt-left">当前排名 <%= rank.rank == 0 ? "--" : rank.rank %></li> <li class="edu-txt-left task-hide"><%= rank.name %></li> - <% if @competition.identifier != "gcc-annotation-2018" %> + <% if @competition.identifier != "gcc-annotation-2018" && @competition.identifier == "gcc-course-2019" %> <li class="color-grey-9"><%= rank.rank == 0 ? "--" : com_spend_time(rank.s_spend_time) %></li> <% end %> <li class="color-orange-tip"><%= rank.rank == 0 ? "--" : "#{rank.s_score}分" %></li> From a6365c76ea948718ea3141e73d7ed87cbe8a4182 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 22 Oct 2019 14:17:24 +0800 Subject: [PATCH 25/50] =?UTF-8?q?=E6=8E=92=E8=A1=8C=E6=A6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/competitions/_chartList.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/competitions/_chartList.html.erb b/app/views/competitions/_chartList.html.erb index 6bfb5582..169b70e4 100644 --- a/app/views/competitions/_chartList.html.erb +++ b/app/views/competitions/_chartList.html.erb @@ -14,7 +14,7 @@ <ul class="team-ranking inline mb10"> <li class="edu-txt-left">当前排名 <%= rank.rank == 0 ? "--" : rank.rank %></li> <li class="edu-txt-left task-hide"><%= rank.name %></li> - <% if @competition.identifier != "gcc-annotation-2018" && @competition.identifier == "gcc-course-2019" %> + <% if @competition.identifier != "gcc-annotation-2018" && @competition.identifier != "gcc-course-2019" %> <li class="color-grey-9"><%= rank.rank == 0 ? "--" : com_spend_time(rank.s_spend_time) %></li> <% end %> <li class="color-orange-tip"><%= rank.rank == 0 ? "--" : "#{rank.s_score}分" %></li> From b2b4d7e7c77c7aa11123f5e3ed3dcc9aac72de1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 22 Oct 2019 14:54:41 +0800 Subject: [PATCH 26/50] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_logined_header.html.erb | 2 +- app/views/layouts/_unlogin_header.html.erb | 2 +- public/react/src/modules/tpm/NewHeader.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index 6da60505..19915869 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -22,7 +22,7 @@ <% end %> <li class="<%= params[:controller] == "competitions" ? " active" : "" %>"> <%= link_to "在线竞赛", competitions_path %> - <img class="roundedRectangles" src="/images/educoder/roundedRectangle.png"/> + <!-- <img class="roundedRectangles" src="/images/educoder/roundedRectangle.png"/>--> </li> <li class="<%= params[:controller] == "libraries" ? " active" : "" %>"><%= link_to "教学案例", libraries_path %></li> <!-- <li class="<%#= params[:controller] == "project_packages" ? " active" : "" %>"><%#= link_to "众包创新", project_packages_path %></li>--> diff --git a/app/views/layouts/_unlogin_header.html.erb b/app/views/layouts/_unlogin_header.html.erb index 0667330c..6ee75008 100644 --- a/app/views/layouts/_unlogin_header.html.erb +++ b/app/views/layouts/_unlogin_header.html.erb @@ -24,7 +24,7 @@ <% end %> <li class="<%= params[:controller] == "competitions" ? " active" : "" %>"> <%= link_to "在线竞赛", competitions_path %> - <img class="roundedRectangles" src="/images/educoder/roundedRectangle.png"/> + <!-- <img class="roundedRectangles" src="/images/educoder/roundedRectangle.png"/>--> </li> <li class="<%= params[:controller] == "libraries" ? " active" : "" %>"><%= link_to "教学案例", libraries_path %></li> <!-- <li class="<%#= params[:controller] == "project_packages" ? " active" : "" %>"><%#= link_to "众包创新", project_packages_path %></li>--> diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index e4cfd6cf..2377198e 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -398,7 +398,7 @@ class NewHeader extends Component { <li className={`${competitions === true ? 'active' : ''}`} > <a href="/competitions">在线竞赛</a> - <img className="roundedRectangles" src="/images/educoder/roundedRectangle.png"/> + {/*<img className="roundedRectangles" src="/images/educoder/roundedRectangle.png"/>*/} </li> <li><a href="/moop_cases">教学案例</a></li> From 7e01c32481df25652f7a4f708b12757910dfff94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 22 Oct 2019 18:14:14 +0800 Subject: [PATCH 27/50] b --- .../ec/ecCompletion_calculation/ecCompletion_calculation.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/ec/ecCompletion_calculation/ecCompletion_calculation.js b/public/react/src/modules/ec/ecCompletion_calculation/ecCompletion_calculation.js index 63dc7a7c..e1dee2b5 100644 --- a/public/react/src/modules/ec/ecCompletion_calculation/ecCompletion_calculation.js +++ b/public/react/src/modules/ec/ecCompletion_calculation/ecCompletion_calculation.js @@ -684,7 +684,9 @@ class EcCompletionCalculation extends Component { // }) } { - Spintype===false?<li className={"clearfix newtarget_scoreclass lipadding10im bordereaeaea"} style={{width: 113*(total_rate_data+4)>1200?(113*(total_rate_data+4.5))+63:1200+"px"}}> + Spintype===false?<li className={"clearfix newtarget_scoreclass lipadding10im bordereaeaea"} style={{width: total_rate_data > 5 ? (180 * total_rate_data+226+16) : 1200 + "px"}} + // style={{width: 113*(total_rate_data+4)>1200?(113*(total_rate_data+4.5))+63:1200+"px"}} + > {/*<span className="column-1 color-05101A mr16 width86">{k+1}</span>*/} <span className="column-1 color-05101A mr16 width86">平均分</span> {/*<span className="column-1 color-05101A ec_graduation_name mr16">{i.student_scores.name}</span>*/} From 2fe3f5741b966106683471b2d1ca52f588b2dc7b Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Wed, 30 Oct 2019 15:42:59 +0800 Subject: [PATCH 28/50] =?UTF-8?q?=E9=A1=B9=E7=9B=AEissue=E8=AF=84=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/journal.rb | 8 ++++---- public/javascripts/create_kindeditor.js | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/app/models/journal.rb b/app/models/journal.rb index 41d81de1..3f6e2563 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -72,10 +72,10 @@ class Journal < ActiveRecord::Base where("(#{Journal.table_name}.private_notes = ? OR (#{Project.allowed_to_condition(user, :view_private_notes, *args)}))", false) } - def save(*args) - # Do not save an empty journal - (details.empty? && notes.blank?) ? false : super - end + # def save(*args) + # # Do not save an empty journal + # (details.empty? && notes.blank?) ? false : super + # end # Returns the new status if the journal contains a status change, otherwise nil def new_status diff --git a/public/javascripts/create_kindeditor.js b/public/javascripts/create_kindeditor.js index fdd493d8..0ac14179 100644 --- a/public/javascripts/create_kindeditor.js +++ b/public/javascripts/create_kindeditor.js @@ -36,7 +36,8 @@ function sd_create_editor(params){ } //params.toolbar_container.hide(); $('#reply_image_' + id).addClass('imageFuzzy'); - if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(this.edit.html())){ + // /^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(this.edit.html())) + if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(this.edit.html()) && $(".upload_filename").length == 0 ){ params.submit_btn.hide(); params.toolbar_container.hide(); this.resize("100%", null); @@ -209,13 +210,17 @@ function sd_check_editor_form_field(params){ if(params.content.html()!=params.textarea.html() || params.issubmit==true){ params.textarea.html(params.content.html()); params.content.sync(); - if(params.content.isEmpty() || /^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(params.textarea.html())){ - params.contentmsg.html('内容不能为空'); + if( + (params.content.isEmpty() && $(".upload_filename").length == 0) + || + (/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(params.textarea.html())&& $(".upload_filename").length == 0)){ + params.contentmsg.html('请填写评论内容或者上传附件!'); params.contentmsg.css({color:'#ff0000'}); - }else{ - params.contentmsg.html('填写正确'); - params.contentmsg.css({color:'#008000'}); } + // else{ + // params.contentmsg.html('填写正确'); + // params.contentmsg.css({color:'#008000'}); + // } params.contentmsg.show(); } } @@ -281,6 +286,7 @@ function sd_create_editor_from_data(id){ }); params.submit_btn.click(function () { var tContents = $("#comment_news_" + id).val(); + console.log("tcontrnet"+tContents); if(tContents != undefined){ var beforeImage = tContents.split("<img"); var afterImage = tContents.split("/>"); From f1c54bdee2cb3fc23d89cac38f90db805605297d Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 4 Nov 2019 16:39:58 +0800 Subject: [PATCH 29/50] =?UTF-8?q?=E8=AF=BE=E5=A0=82=E7=9A=84=E9=82=AE?= =?UTF-8?q?=E4=BB=B6=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 10 ++++++++++ .../managements/_classroom_classment_list.html.erb | 11 +++++++++++ .../managements/course_board_email_notify.js.erb | 0 config/routes.rb | 1 + 4 files changed, 22 insertions(+) create mode 100644 app/views/managements/course_board_email_notify.js.erb diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index df14dd53..06a09f93 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -2210,6 +2210,16 @@ end end end + + # 讨论区邮件通知 + def course_board_email_notify + if params[:course_id] + course = Course.find params[:course_id] + course.update_attributes(:email_notify => !course.email_notify) + end + end + + # 课程实训 def class_shixuns @menu_type = 4 diff --git a/app/views/managements/_classroom_classment_list.html.erb b/app/views/managements/_classroom_classment_list.html.erb index 2b9c98cb..9321c495 100644 --- a/app/views/managements/_classroom_classment_list.html.erb +++ b/app/views/managements/_classroom_classment_list.html.erb @@ -40,6 +40,8 @@ <a href="<%= hidden_course_managements_path(:course_id => course.id) %>" class="mr5 fr" data-remote="true" id="hidden_course_<%= course.id %>"><%= course.is_hidden ? "显示" : "隐藏" %></a> <input type="checkbox" name="homepage_show" value="<%= course.id %>" <%= course.homepage_show ? "checked" : "" %> class="ml-3 mr5 magic-checkbox" id="join_course_role_<%= course.id %>"> <label style="top:0px;padding-left: 25px;float:right; margin-right: 10px" for="join_course_role_<%= course.id %>">首页显示</label> + <input type="checkbox" name="email_notify" value="<%= course.id %>" <%= course.email_notify ? "checked" : "" %> class="ml-3 mr5 magic-checkbox" id="email_notify_<%= course.id %>"> + <label style="top:0px;padding-left: 25px;float:right; margin-right: 10px" for="email_notify_<%= course.id %>">邮件通知</label> </td> </tr> <% end %> @@ -74,4 +76,13 @@ dateType: "script" }); }) + $("input[name='email_notify']").click(function(){ + var course_id = $(this).val(); + $.ajax({ + url:"<%= course_board_email_notify_managements_path %>", + data: {course_id: course_id}, + type: 'post', + dateType: "script" + }); + }) </script> diff --git a/app/views/managements/course_board_email_notify.js.erb b/app/views/managements/course_board_email_notify.js.erb new file mode 100644 index 00000000..e69de29b diff --git a/config/routes.rb b/config/routes.rb index ef6d561c..49f180bb 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -625,6 +625,7 @@ RedmineApp::Application.routes.draw do ## oauth相关 get 'update_shixun_hidden' get 'update_subject_hidden' post 'course_homepage_show' + post 'course_board_email_notify' post 'shixun_homepage_show' post 'update_shixun_task_pass' post 'update_shixun_code_hidden' From 7cb079359c39e11e6d4d5616f8cb39dbf0dbaae5 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 7 Nov 2019 10:58:01 +0800 Subject: [PATCH 30/50] =?UTF-8?q?=E8=AF=BE=E5=A0=82=E7=9A=84=E9=82=AE?= =?UTF-8?q?=E4=BB=B6=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/course.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/course.rb b/app/models/course.rb index 796ea3c9..ff56ed80 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -139,7 +139,8 @@ class Course < ActiveRecord::Base 'choose_group_allow', 'credit', 'homepage_show', - 'show_unit' + 'show_unit', + 'email_notify' acts_as_customizable From 5ba6e70e1efc398015755984d2c18d052b1d0113 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 7 Nov 2019 11:01:19 +0800 Subject: [PATCH 31/50] =?UTF-8?q?=E9=82=AE=E4=BB=B6=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/course.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/course.rb b/app/models/course.rb index ff56ed80..ac073a44 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -26,7 +26,7 @@ class Course < ActiveRecord::Base attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public, :description,:class_period, :open_student, :enterprise_name, :is_delete, :syllabus_id, :end_time, :end_term, - :choose_group_allow, :is_end, :homepage_show, :course_list_id, :teacher_list, :student_list, :is_hidden + :choose_group_allow, :is_end, :homepage_show, :course_list_id, :teacher_list, :student_list, :is_hidden, :email_notify #belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher,该方法通过tea_id来调用User表 belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school,该方法通过school_id来调用School表 From ad61dc8ceeeb8db7fcdcb00a6bd135145b7fb5eb Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 13 Nov 2019 09:35:40 +0800 Subject: [PATCH 32/50] =?UTF-8?q?=E5=BC=95=E6=B5=81=E6=8A=A5500?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 06a09f93..b19bbaf9 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -29,7 +29,7 @@ class ManagementsController < ApplicationController end def user_agents - @user_agents = UserAgent.where("user_agents.key is not order by action_status, register_status") + @user_agents = UserAgent.where("user_agents.key is not null order by action_status, register_status") @agents_count = @user_agents.count limit = 20 @agents_pages = Paginator.new @agents_count, limit, params['page'] || 1 From bd32c34de9ebd5a70ea3ea5e497ad50a7e53327b Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 13 Nov 2019 09:46:20 +0800 Subject: [PATCH 33/50] =?UTF-8?q?=E5=BC=95=E6=B5=81=E6=8A=A5500?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index b19bbaf9..b90e9e76 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -29,7 +29,7 @@ class ManagementsController < ApplicationController end def user_agents - @user_agents = UserAgent.where("user_agents.key is not null order by action_status, register_status") + @user_agents = UserAgent.where("user_agents.key is not null").order("action_status asc, register_status asc") @agents_count = @user_agents.count limit = 20 @agents_pages = Paginator.new @agents_count, limit, params['page'] || 1 From 8ba524bd76c3d8282c82f07d4d85dcc4ccae1030 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 13 Nov 2019 11:46:32 +0800 Subject: [PATCH 34/50] =?UTF-8?q?=E5=BC=95=E6=B5=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 41 +++++++++++++++++++ .../managements/_user_agent_list.html.erb | 1 + 2 files changed, 42 insertions(+) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index b90e9e76..d04b4f23 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -35,6 +35,15 @@ class ManagementsController < ApplicationController @agents_pages = Paginator.new @agents_count, limit, params['page'] || 1 @offset ||= @agents_pages.offset @user_agents = paginateHelper @user_agents, limit + respond_to do |format| + format.html + format.xls{ + time = Time.now.strftime("%Y%m%d") + filename = "实训课程体系#{time}.xls" + send_data(user_agents_export(), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename)) + } + end + end # 实训课程等级体系 @@ -4369,6 +4378,38 @@ end return sheet.rows end + def user_agents_export + xls_report = StringIO.new + book = Spreadsheet::Workbook.new + sheet1 = book.create_worksheet :name => "引流名单" + blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 + sheet1.row(0).default_format = blue + count_row = 1 + sheet1.row(0).concat(["序号", "LoginId", "姓名", "学校名称", "手机号", "邮箱", "参赛人数", "参赛队伍", "访问量"]) + user_agents = UserAgent.where("user_agents.key is not null").pluck(:key).uniq + user_agents.each_with_index do |agent, index| + user = User.find_by_login(agent) + # 代理用户 + agents = UserAgent.where(key: agent) + agents_count = agents.count + competion_users = agents.where(agent_type: UserAgent::USER_COMPETITION).pluck(:ip) + rank_user_id = UserActions.where(ip: competion_users).pluck(:user_id).uniq + team_ids = TeamMember.where(user_id: rank_user_id).pluck(:competition_team_id).uniq + sheet1[count_row, 0] = index + 1 + sheet1[count_row, 1] = agent + sheet1[count_row, 2] = user.show_real_name + sheet1[count_row, 3] = user.school_name + sheet1[count_row, 4] = user.phone + sheet1[count_row, 5] = user.mail + sheet1[count_row, 6] = competion_users.count + sheet1[count_row, 7] = team_ids.count + sheet1[count_row, 8] = agents_count + count_row += 1 + end + book.write xls_report + xls_report.string + end + def export_subject_level_system xls_report = StringIO.new book = Spreadsheet::Workbook.new diff --git a/app/views/managements/_user_agent_list.html.erb b/app/views/managements/_user_agent_list.html.erb index 6b47e51c..8c11a208 100644 --- a/app/views/managements/_user_agent_list.html.erb +++ b/app/views/managements/_user_agent_list.html.erb @@ -8,6 +8,7 @@ <th width="10%">竞赛报名状态</th> <th width="10%">ip</th> <th width="20%">负责人</th> + <a href="<%= user_agents_managements_path(:format => "xls") %>" class="task-btn mr10 task-btn-orange fr">导出</a> </thead> <tbody> <% @user_agents.each do |ua| %> From 8788e8c11bb864f379aa6d3da0499448c224e84f Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 13 Nov 2019 11:55:00 +0800 Subject: [PATCH 35/50] =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=B8=BA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index d04b4f23..2b73e7cc 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -4389,6 +4389,7 @@ end user_agents = UserAgent.where("user_agents.key is not null").pluck(:key).uniq user_agents.each_with_index do |agent, index| user = User.find_by_login(agent) + logger.info("###########user:#{agent}") if user.blank? # 代理用户 agents = UserAgent.where(key: agent) agents_count = agents.count From b1a735c1ecd5f37924b8fc41bc6a732fa146fa4f Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 13 Nov 2019 11:56:11 +0800 Subject: [PATCH 36/50] =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=B8=BA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 2b73e7cc..e83993c4 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -4389,7 +4389,7 @@ end user_agents = UserAgent.where("user_agents.key is not null").pluck(:key).uniq user_agents.each_with_index do |agent, index| user = User.find_by_login(agent) - logger.info("###########user:#{agent}") if user.blank? + next if user.blank? # 代理用户 agents = UserAgent.where(key: agent) agents_count = agents.count From 4c8e1917ab65fcea0b6f82a30b57594a9bf27b73 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 13 Nov 2019 13:03:34 +0800 Subject: [PATCH 37/50] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/colleges_controller.rb | 2 +- app/views/colleges/statistics.html.erb | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/colleges_controller.rb b/app/controllers/colleges_controller.rb index cc4e6c9a..93d2df8e 100644 --- a/app/controllers/colleges_controller.rb +++ b/app/controllers/colleges_controller.rb @@ -258,7 +258,7 @@ class CollegesController < ApplicationController unless (User.current.admin? || User.current.business? || (@department.present? && DepartmentMember.where(:user_id => User.current.id, :department_id => @department.id).first.present?) || (User.current.user_extensions.try(:school_id) == @school.id && User.current.user_extensions.try(:identity) == 0) || - (@school.try(:customer_id) && User.current.try(:partner).try(:customer_ids) && User.current.try(:partner).try(:customer_ids).include?(@school.try(:customer_id)))) + (@school.try(:customer_id) && User.current.try(:partner).try(:customer_ids) && User.current.try(:partner).try(:customer_ids).include?(@school.try(:customer_id)))) render_403 end end diff --git a/app/views/colleges/statistics.html.erb b/app/views/colleges/statistics.html.erb index 8df81fcb..cc7ff4e6 100644 --- a/app/views/colleges/statistics.html.erb +++ b/app/views/colleges/statistics.html.erb @@ -139,15 +139,15 @@ }) }); - $.get('<%= shixun_time_college_path(@school) %>', function(data){ + $.get('<%= shixun_time_college_path(@department.identifier) %>', function(data){ $('.shixun-time').html("<span data-tip-down=\"所有学员的实训耗时之和\">" + data.shixun_time + "</span>天"); }); - $.get('<%= shixun_report_count_college_path(@school) %>', function(data){ + $.get('<%= shixun_report_count_college_path(@department.identifier) %>', function(data){ $('.shixun-report-count').html("<span>" + data.shixun_report_count + "</span>个"); }); // 教师排名 - $.ajax({ url: '<%= teachers_college_path(@school) %>', method: 'GET', dataType: 'script' }) + $.ajax({ url: '<%= teachers_college_path(@department.identifier) %>', method: 'GET', dataType: 'script' }) $(".count_student_test a").click(function(){ $(".count_student_test a").removeClass("active"); @@ -155,7 +155,7 @@ }); //初始化饼状图 - $.get('<%= shixun_chart_data_college_path(@school) %>', function(data){ + $.get('<%= shixun_chart_data_college_path(@department.identifier) %>', function(data){ $('.pie-chart-loading').hide(); if (data.names.length > 0) { $('.online_status .edu-tab-con-box').hide(); @@ -166,7 +166,7 @@ } }); - $.get('<%= course_statistics_college_path(@school) %>'); + $.get('<%= course_statistics_college_path(@department.identifier) %>'); }); function InitPieChart(names, data){ var Color = ['#49A9EE', '#FFD86E', '#98D87D', '#8996E6', '#F3857B', '#B97BF3','#4DE8B4','#F37BDB','#566EFF','#FF961A']; From a09ef2965de173e2b7ef1ea39402be1f2b89d234 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 13 Nov 2019 13:59:46 +0800 Subject: [PATCH 38/50] =?UTF-8?q?=E5=BC=95=E6=B5=81=E5=8F=82=E8=B5=9B?= =?UTF-8?q?=E4=BA=BA=E6=95=B0=E4=B8=8D=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index e83993c4..1c14e82e 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -4393,7 +4393,7 @@ end # 代理用户 agents = UserAgent.where(key: agent) agents_count = agents.count - competion_users = agents.where(agent_type: UserAgent::USER_COMPETITION).pluck(:ip) + competion_users = agents.where(action_status: 2).pluck(:ip) rank_user_id = UserActions.where(ip: competion_users).pluck(:user_id).uniq team_ids = TeamMember.where(user_id: rank_user_id).pluck(:competition_team_id).uniq sheet1[count_row, 0] = index + 1 From 4499081def233d5d96b6af1b141c0ec39221aaa9 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 13 Nov 2019 14:00:49 +0800 Subject: [PATCH 39/50] =?UTF-8?q?=E5=BC=95=E6=B5=81=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 1c14e82e..884e32a8 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -39,7 +39,7 @@ class ManagementsController < ApplicationController format.html format.xls{ time = Time.now.strftime("%Y%m%d") - filename = "实训课程体系#{time}.xls" + filename = "引流情况#{time}.xls" send_data(user_agents_export(), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename)) } end From 223d2ad5b5a85af1b4b9feaebec68e342d1e96c7 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 13 Nov 2019 15:07:46 +0800 Subject: [PATCH 40/50] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/colleges/statistics.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/colleges/statistics.html.erb b/app/views/colleges/statistics.html.erb index cc7ff4e6..3a301077 100644 --- a/app/views/colleges/statistics.html.erb +++ b/app/views/colleges/statistics.html.erb @@ -50,7 +50,7 @@ <div class="white-panel mb20 pl0 clearfix"> <li class="active" index="1"><a href="javascript:void(0);">课堂</a></li> - <li index="2"><a href="<%= student_shixun_college_path(@school) %>" data-remote="true">学生实训</a></li> + <li index="2"><a href="<%= student_shixun_college_path(@department.identifier) %>" data-remote="true">学生实训</a></li> <!--<li><a href="<%#= engineering_capability_college_path(@department) %>" data-remote="true">工程能力</a></li>--> <!-- <li index="4"><a href="<%#= student_eval_college_path(@school) %>" data-remote="true">学生测评</a></li>--> </div> From 923455f18468504581fb5ef9432ffa5a14268066 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 13 Nov 2019 15:18:41 +0800 Subject: [PATCH 41/50] =?UTF-8?q?=E9=AB=98=E6=A0=A1=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/colleges/_student_shixun.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/colleges/_student_shixun.html.erb b/app/views/colleges/_student_shixun.html.erb index 44214bc6..88e8aa1a 100644 --- a/app/views/colleges/_student_shixun.html.erb +++ b/app/views/colleges/_student_shixun.html.erb @@ -28,7 +28,7 @@ <script> $(function(){ //初始化最热评测柱状图 - $.get('<%= student_hot_evaluations_college_path(@school) %>', function(data){ + $.get('<%= student_hot_evaluations_college_path(@department.identifier) %>', function(data){ InitHotEvaluating(data.names.reverse(), data.values.reverse()); }) }); From dfd8d1eab376bbcd20bacdf6bb3376c01af1635f Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 14 Nov 2019 11:03:52 +0800 Subject: [PATCH 42/50] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=8A=A5500?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/colleges/_student_shixun.html.erb | 2 +- app/views/colleges/statistics.html.erb | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/views/colleges/_student_shixun.html.erb b/app/views/colleges/_student_shixun.html.erb index 88e8aa1a..bdda486b 100644 --- a/app/views/colleges/_student_shixun.html.erb +++ b/app/views/colleges/_student_shixun.html.erb @@ -28,7 +28,7 @@ <script> $(function(){ //初始化最热评测柱状图 - $.get('<%= student_hot_evaluations_college_path(@department.identifier) %>', function(data){ + $.get('<%= student_hot_evaluations_college_path(@department.try(:identifier) || @school) %>', function(data){ InitHotEvaluating(data.names.reverse(), data.values.reverse()); }) }); diff --git a/app/views/colleges/statistics.html.erb b/app/views/colleges/statistics.html.erb index 3a301077..eacd0dc6 100644 --- a/app/views/colleges/statistics.html.erb +++ b/app/views/colleges/statistics.html.erb @@ -50,7 +50,7 @@ <div class="white-panel mb20 pl0 clearfix"> <li class="active" index="1"><a href="javascript:void(0);">课堂</a></li> - <li index="2"><a href="<%= student_shixun_college_path(@department.identifier) %>" data-remote="true">学生实训</a></li> + <li index="2"><a href="<%= student_shixun_college_path(@department.try(:identifier) || @school) %>" data-remote="true">学生实训</a></li> <!--<li><a href="<%#= engineering_capability_college_path(@department) %>" data-remote="true">工程能力</a></li>--> <!-- <li index="4"><a href="<%#= student_eval_college_path(@school) %>" data-remote="true">学生测评</a></li>--> </div> @@ -139,15 +139,15 @@ }) }); - $.get('<%= shixun_time_college_path(@department.identifier) %>', function(data){ + $.get('<%= shixun_time_college_path(@department.try(:identifier) || @school) %>', function(data){ $('.shixun-time').html("<span data-tip-down=\"所有学员的实训耗时之和\">" + data.shixun_time + "</span>天"); }); - $.get('<%= shixun_report_count_college_path(@department.identifier) %>', function(data){ + $.get('<%= shixun_report_count_college_path(@department.try(:identifier) || @school) %>', function(data){ $('.shixun-report-count').html("<span>" + data.shixun_report_count + "</span>个"); }); // 教师排名 - $.ajax({ url: '<%= teachers_college_path(@department.identifier) %>', method: 'GET', dataType: 'script' }) + $.ajax({ url: '<%= teachers_college_path(@department.try(:identifier) || @school) %>', method: 'GET', dataType: 'script' }) $(".count_student_test a").click(function(){ $(".count_student_test a").removeClass("active"); @@ -155,7 +155,7 @@ }); //初始化饼状图 - $.get('<%= shixun_chart_data_college_path(@department.identifier) %>', function(data){ + $.get('<%= shixun_chart_data_college_path(@department.try(:identifier) || @school) %>', function(data){ $('.pie-chart-loading').hide(); if (data.names.length > 0) { $('.online_status .edu-tab-con-box').hide(); @@ -166,7 +166,7 @@ } }); - $.get('<%= course_statistics_college_path(@department.identifier) %>'); + $.get('<%= course_statistics_college_path(@department.try(:identifier) || @school) %>'); }); function InitPieChart(names, data){ var Color = ['#49A9EE', '#FFD86E', '#98D87D', '#8996E6', '#F3857B', '#B97BF3','#4DE8B4','#F37BDB','#566EFF','#FF961A']; From fd3bf9104db829a7026572e8248ebb92c7273256 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 20 Nov 2019 16:57:08 +0800 Subject: [PATCH 43/50] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E6=88=91=E7=9A=84?= =?UTF-8?q?=E4=BC=97=E5=8C=85=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_logined_header.html.erb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index 19915869..1133f2e5 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -63,7 +63,6 @@ display: none; right:110px;"> <li><%= link_to '我的实训项目', user_path(User.current, :type => 'a_shixun') %></li> <li><%= link_to '我的实践课程', user_path(User.current, :type => 'a_path') %></li> <li><%= link_to '我的开发项目', user_path(User.current, :type => 'a_project') %></li> - <li><%= link_to '我的众包', user_path(User.current, :type => 'a_package') %></li> <% if User.current.partner.present? %> <li><%= link_to '客户管理', partner_list_cooperate_path(User.current.partner) %></li> <% end %> From 1ecc4dbd6e7fdf8d213b6bcf3e3de630b2ec435d Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 21 Nov 2019 14:37:46 +0800 Subject: [PATCH 44/50] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=80=81=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E7=9A=84=E5=AE=9E=E5=90=8D=E8=AE=A4=E8=AF=81=E5=92=8C?= =?UTF-8?q?=E8=81=8C=E4=B8=9A=E8=AE=A4=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_management.html.erb | 4 ++-- config/routes.rb | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/views/layouts/base_management.html.erb b/app/views/layouts/base_management.html.erb index fc5e0afe..11bc2527 100644 --- a/app/views/layouts/base_management.html.erb +++ b/app/views/layouts/base_management.html.erb @@ -114,8 +114,8 @@ </li> <li class="fl edu-admin-nav-li edu-position <%= 'active' if @menu_type == 10 %>"><a href="javascript:void(0);" class="edu-admin-nav-a">审批</a> <ul class="edu-admin-nav-inner"> - <li><%= link_to "实名认证", identity_authentication_managements_path %></li> - <li><%= link_to "职业认证", professional_authentication_managements_path %></li> +<!-- <li><%#= link_to "实名认证", identity_authentication_managements_path %></li>--> +<!-- <li><%#= link_to "职业认证", professional_authentication_managements_path %></li>--> <li><%= link_to "试用授权", trial_authorization_managements_path %></li> <li><%= link_to "部门审批", depart_managements_path %></li> <li><%= link_to '单位审批', unit_managements_path %></li> diff --git a/config/routes.rb b/config/routes.rb index 49f180bb..1acbdc9f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -619,9 +619,9 @@ RedmineApp::Application.routes.draw do ## oauth相关 match 'users_authorization_agree' match 'users_authorization_cancel' get 'update_webssh' - get 'professional_authentication', :as => 'professional_authentication' - get 'agree_authentication_pro' - post 'reject_authentication_pro' + # get 'professional_authentication', :as => 'professional_authentication' + # get 'agree_authentication_pro' + # post 'reject_authentication_pro' get 'update_shixun_hidden' get 'update_subject_hidden' post 'course_homepage_show' @@ -2383,9 +2383,9 @@ RedmineApp::Application.routes.draw do ## oauth相关 get 'admin/code_work_tests' post 'admin/select_course_syllabus' post 'admin/create_syllabus' - get 'admin/identity_authentication' - get 'admin/reject_authentication' - get 'admin/agree_authentication' + # get 'admin/identity_authentication' + # get 'admin/reject_authentication' + # get 'admin/agree_authentication' resources :auth_sources do member do From 202a067d27b70a434d80e27d3d5cc470979931bf Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 21 Nov 2019 14:44:14 +0800 Subject: [PATCH 45/50] =?UTF-8?q?=E8=B7=AF=E7=94=B1=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/routes.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 1acbdc9f..3745c502 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -609,10 +609,10 @@ RedmineApp::Application.routes.draw do ## oauth相关 get 'batch_authorization', :as => 'batch_authorization' match 'search_user', :via => [:get, :post] match 'affirm_cancel_auth', :via => [:get, :post] - get 'identity_authentication', :as => 'identity_authentication' + # get 'identity_authentication', :as => 'identity_authentication' match 'trial_authorization_operation', :as => 'trial_authorization_operation' - get 'reject_authentication' - get 'agree_authentication' + # get 'reject_authentication' + # get 'agree_authentication' match 'users', :via => [:get, :post] get 'users_trial' get 'auto_users_trial' From a14459698339d944a20243ede3ccde43218e7a67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 28 Nov 2019 18:06:11 +0800 Subject: [PATCH 46/50] =?UTF-8?q?=E9=9A=90=E8=97=8F=E7=AB=9E=E8=B5=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/NewHeader.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 2377198e..0d8194fb 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -238,11 +238,11 @@ class NewHeader extends Component { } else { var uid = false } - if(!uid){ - this.setState({ - competitiontype:true - }) - } + // if(!uid){ + // this.setState({ + // competitiontype:true + // }) + // } } setcompetitionfun=()=>{ From b091c0177736793caab36a5954c25a9b1d41c0a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 28 Nov 2019 19:22:40 +0800 Subject: [PATCH 47/50] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_returnTop_btn.html.erb | 32 --------------- public/react/src/modules/tpm/SiderBar.js | 50 ++++++++++++------------ 2 files changed, 25 insertions(+), 57 deletions(-) diff --git a/app/views/users/_returnTop_btn.html.erb b/app/views/users/_returnTop_btn.html.erb index 9a3c7c32..1ce6b917 100644 --- a/app/views/users/_returnTop_btn.html.erb +++ b/app/views/users/_returnTop_btn.html.erb @@ -30,35 +30,3 @@ </div> -<div id="trophyreturn" class="-task-sidebars" style="right: 65px !important;width: 154px;"> - <a onclick="trophyreturnfun();" id="closeIcon" style="position: absolute;right: 12px;top: 10px; color: #000;"> - <i class="iconfont icon-shanchudiao"></i> - </a> - <a href="/competitions"> - <img src="/images/educoder/competition/lvmeng.png" width="150px" height="150px"> - </a> - -</div> -<script> - function trophyreturnfun(){ - $("#trophyreturn").hide() - localStorage.setItem('trophy_uid', true); - } - - $(function() { - - var trophy_uid = false; - - if (window.localStorage) { - trophy_uid = localStorage.getItem('trophy_uid'); - } else { - trophy_uid = false - } - - if(trophy_uid==="true"||trophy_uid===true){ - $("#trophyreturn").hide() - } - - }) - -</script> diff --git a/public/react/src/modules/tpm/SiderBar.js b/public/react/src/modules/tpm/SiderBar.js index b7f5b5ec..0b88a37d 100644 --- a/public/react/src/modules/tpm/SiderBar.js +++ b/public/react/src/modules/tpm/SiderBar.js @@ -13,26 +13,26 @@ class SiderBar extends Component { } componentDidMount() { - window._initSider(); - var trophy_uid = false; - if (window.localStorage) { - trophy_uid = localStorage.getItem('trophy_uid'); - } else { - trophy_uid = false - } - if(trophy_uid==="true"||trophy_uid===true){ - this.setState({ - trophyreturn:true - }) - } + // window._initSider(); + // var trophy_uid = false; + // if (window.localStorage) { + // trophy_uid = localStorage.getItem('trophy_uid'); + // } else { + // trophy_uid = false + // } + // if(trophy_uid==="true"||trophy_uid===true){ + // this.setState({ + // trophyreturn:true + // }) + // } } trophyreturnfun=()=>{ - this.setState({ - trophyreturn:true - }) - localStorage.setItem('trophy_uid', true); + // this.setState({ + // trophyreturn:true + // }) + // localStorage.setItem('trophy_uid', true); } render() { return ( @@ -70,15 +70,15 @@ class SiderBar extends Component { </div> </div> - {this.state.trophyreturn===true?"":<div className="-task-sidebars" style={{right: "65x",width: "154px"}}> - <a onClick={this.trophyreturnfun} id="closeIcon" - style={{position: "absolute", right: "12px",top:"10px",color: "#000"}}> - <i className="iconfont icon-shanchudiao"></i> - </a> - <a href="/competitions"> - <img src={getImageUrl("images/educoder/competition/lvmeng.png")} width="150px" height="150px" /> - </a> - </div>} + {/*{this.state.trophyreturn===true?"":<div className="-task-sidebars" style={{right: "65x",width: "154px"}}>*/} + {/* <a onClick={this.trophyreturnfun} id="closeIcon"*/} + {/* style={{position: "absolute", right: "12px",top:"10px",color: "#000"}}>*/} + {/* <i className="iconfont icon-shanchudiao"></i>*/} + {/* </a>*/} + {/* <a href="/competitions">*/} + {/* <img src={getImageUrl("images/educoder/competition/lvmeng.png")} width="150px" height="150px" />*/} + {/* </a>*/} + {/*</div>}*/} </div> ); From 8812337e4916313b3a6b501431723196c5c77507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 10 Dec 2019 11:12:52 +0800 Subject: [PATCH 48/50] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E6=8E=92=E8=A1=8C=E6=A6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/welcome/index.html.erb | 192 +++++++++++++++---------------- 1 file changed, 96 insertions(+), 96 deletions(-) diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 29370db3..8bcc3ae3 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -81,101 +81,101 @@ <!--导师排行榜--> - <div class="pt60 pb60 mb30 mentor-ranking"> - <div class="educontent"> - <div class="edu-txt-center"> - <p class="color-dark edu-txt-center font-24" style="line-height: 30px">导师排行榜</p> - <p class="color-grey-cd font-12">MENTOR RANKING</p> - </div> - <div class="ranking clearfix"> - <ul class="grade color-dark"> - <% if @tea_users[1] %> - <li class="mt35 pr"> - <img src="/images/educoder/huangguan-two.png" class="huangguan"/> - <a href="/users/<%= (@tea_users[1].try(:login)) %>" class="color-dark"><%= image_tag(url_to_avatar(@tea_users[1])) %> - <span class="task-hide rankName"><%= @tea_users[1].try(:show_name) %></span> - </a> - </li> - <% end %> - <% if @tea_users[0] %> - <li class="pr"> - <img src="/images/educoder/huangguan.png" class="huangguan"/> - <a href="/users/<%= (@tea_users[0].try(:login)) %>" class="color-dark"><%= image_tag(url_to_avatar(@tea_users[0])) %> - <span class="task-hide rankName"><%= @tea_users[0].try(:show_name) %></span> - </a> - </li> - <% end %> - <% if @tea_users[2] %> - <li class="mt35 pr"> - <img src="/images/educoder/huangguan-three.png" class="huangguan"/> - <a href="/users/<%=(@tea_users[2].try(:login)) %>" class="color-dark"><%= image_tag(url_to_avatar(@tea_users[2])) %> - <span class="task-hide rankName"><%= @tea_users[2].try(:show_name) %></span> - </a> - </li> - <% end %> - </ul> - <br/> - <ul class="grade mt30"> - <% if @tea_users.size > 3 %> - <% @tea_users[3..@tea_users.size].each do |t_u| %> - <li> - <a href="/users/<%= t_u.try(:login) %>" class="color-dark"><%= image_tag(url_to_avatar(t_u)) %> - <span class="task-hide rankName"><%= t_u.try(:show_name) %></span> - </a> - </li> - <% end %> - <% end %> - </ul> - </div> - </div> - </div> +# <div class="pt60 pb60 mb30 mentor-ranking"> +# <div class="educontent"> +# <div class="edu-txt-center"> +# <p class="color-dark edu-txt-center font-24" style="line-height: 30px">导师排行榜</p> +# <p class="color-grey-cd font-12">MENTOR RANKING</p> +# </div> +# <div class="ranking clearfix"> +# <ul class="grade color-dark"> +# <% if @tea_users[1] %> +# <li class="mt35 pr"> +# <img src="/images/educoder/huangguan-two.png" class="huangguan"/> +# <a href="/users/<%= (@tea_users[1].try(:login)) %>" class="color-dark"><%= image_tag(url_to_avatar(@tea_users[1])) %> +# <span class="task-hide rankName"><%= @tea_users[1].try(:show_name) %></span> +# </a> +# </li> +# <% end %> +# <% if @tea_users[0] %> +# <li class="pr"> +# <img src="/images/educoder/huangguan.png" class="huangguan"/> +# <a href="/users/<%= (@tea_users[0].try(:login)) %>" class="color-dark"><%= image_tag(url_to_avatar(@tea_users[0])) %> +# <span class="task-hide rankName"><%= @tea_users[0].try(:show_name) %></span> +# </a> +# </li> +# <% end %> +# <% if @tea_users[2] %> +# <li class="mt35 pr"> +# <img src="/images/educoder/huangguan-three.png" class="huangguan"/> +# <a href="/users/<%=(@tea_users[2].try(:login)) %>" class="color-dark"><%= image_tag(url_to_avatar(@tea_users[2])) %> +# <span class="task-hide rankName"><%= @tea_users[2].try(:show_name) %></span> +# </a> +# </li> +# <% end %> +# </ul> +# <br/> +# <ul class="grade mt30"> +# <% if @tea_users.size > 3 %> +# <% @tea_users[3..@tea_users.size].each do |t_u| %> +# <li> +# <a href="/users/<%= t_u.try(:login) %>" class="color-dark"><%= image_tag(url_to_avatar(t_u)) %> +# <span class="task-hide rankName"><%= t_u.try(:show_name) %></span> +# </a> +# </li> +# <% end %> +# <% end %> +# </ul> +# </div> +# </div> +# </div> <!--程序员排行榜--> - <div class="pt60 pb60 mb30 pro-ranking"> - <div class="educontent"> - <div class="edu-txt-center"> - <p class="color-dark edu-txt-center font-24" style="line-height: 30px">程序员排行榜</p> - <p class="color-grey-cd font-12">PROGRAMMER RANKING</p> - </div> - <div class="ranking clearfix"> - <ul class="grade color-dark"> - <% if @stu_users[1] %> - <li class="mt35 pr"> - <img src="/images/educoder/huangguan-two.png" class="huangguan"/> - <a href="/users/<%= @stu_users[1].try(:login) %>" class="color-dark"><%= image_tag(url_to_avatar(@stu_users[1])) %> - <span class="task-hide rankName"><%= @stu_users[1].try(:show_name) %></span> - </a> - </li> - <% end %> - <% if @stu_users[0] %> - <li class="pr"> - <img src="/images/educoder/huangguan.png" class="huangguan"/> - <a href="/users/<%= @stu_users[0].try(:login) %>" class="color-dark"><%= image_tag(url_to_avatar(@stu_users[0])) %> - <span class="task-hide rankName"><%= @stu_users[0].try(:show_name) %></span> - </a> - </li> - <% end %> - <% if @stu_users[2] %> - <li class="mt35 pr"> - <img src="/images/educoder/huangguan-three.png" class="huangguan"/> - <a href="/users/<%= (@stu_users[2].try(:login)) %>" class="color-dark"><%= image_tag(url_to_avatar(@stu_users[2])) %> - <span class="task-hide rankName"><%= @stu_users[2].try(:show_name) %></span> - </a> - </li> - <% end %> - </ul> - <br/> - <ul class="grade mt30"> - <% if @stu_users.size > 3 %> - <% @stu_users[3..@stu_users.size].each do |e_u| %> - <li> - <a href="/users/<%= e_u.try(:login) %>" class="color-dark"><%= image_tag(url_to_avatar(e_u)) %> - <span class="task-hide rankName"><%= e_u.try(:show_name) %></span> - </a> - </li> - <% end %> - <% end %> - </ul> - </div> - </div> - </div> +# <div class="pt60 pb60 mb30 pro-ranking"> +# <div class="educontent"> +# <div class="edu-txt-center"> +# <p class="color-dark edu-txt-center font-24" style="line-height: 30px">程序员排行榜</p> +# <p class="color-grey-cd font-12">PROGRAMMER RANKING</p> +# </div> +# <div class="ranking clearfix"> +# <ul class="grade color-dark"> +# <% if @stu_users[1] %> +# <li class="mt35 pr"> +# <img src="/images/educoder/huangguan-two.png" class="huangguan"/> +# <a href="/users/<%= @stu_users[1].try(:login) %>" class="color-dark"><%= image_tag(url_to_avatar(@stu_users[1])) %> +# <span class="task-hide rankName"><%= @stu_users[1].try(:show_name) %></span> +# </a> +# </li> +# <% end %> +# <% if @stu_users[0] %> +# <li class="pr"> +# <img src="/images/educoder/huangguan.png" class="huangguan"/> +# <a href="/users/<%= @stu_users[0].try(:login) %>" class="color-dark"><%= image_tag(url_to_avatar(@stu_users[0])) %> +# <span class="task-hide rankName"><%= @stu_users[0].try(:show_name) %></span> +# </a> +# </li> +# <% end %> +# <% if @stu_users[2] %> +# <li class="mt35 pr"> +# <img src="/images/educoder/huangguan-three.png" class="huangguan"/> +# <a href="/users/<%= (@stu_users[2].try(:login)) %>" class="color-dark"><%= image_tag(url_to_avatar(@stu_users[2])) %> +# <span class="task-hide rankName"><%= @stu_users[2].try(:show_name) %></span> +# </a> +# </li> +# <% end %> +# </ul> +# <br/> +# <ul class="grade mt30"> +# <% if @stu_users.size > 3 %> +# <% @stu_users[3..@stu_users.size].each do |e_u| %> +# <li> +# <a href="/users/<%= e_u.try(:login) %>" class="color-dark"><%= image_tag(url_to_avatar(e_u)) %> +# <span class="task-hide rankName"><%= e_u.try(:show_name) %></span> +# </a> +# </li> +# <% end %> +# <% end %> +# </ul> +# </div> +# </div> +# </div> </div> From f5e822a6648a56ee1f29f56daf62313563ada918 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 10 Dec 2019 11:18:22 +0800 Subject: [PATCH 49/50] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/welcome/index.html.erb | 101 ------------------------------- 1 file changed, 101 deletions(-) diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 8bcc3ae3..f5d21468 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -77,105 +77,4 @@ <%= render :partial => "shixuns/shixun_item", :locals => {:shixuns => @shixuns} %> </div> </div> - - - - <!--导师排行榜--> -# <div class="pt60 pb60 mb30 mentor-ranking"> -# <div class="educontent"> -# <div class="edu-txt-center"> -# <p class="color-dark edu-txt-center font-24" style="line-height: 30px">导师排行榜</p> -# <p class="color-grey-cd font-12">MENTOR RANKING</p> -# </div> -# <div class="ranking clearfix"> -# <ul class="grade color-dark"> -# <% if @tea_users[1] %> -# <li class="mt35 pr"> -# <img src="/images/educoder/huangguan-two.png" class="huangguan"/> -# <a href="/users/<%= (@tea_users[1].try(:login)) %>" class="color-dark"><%= image_tag(url_to_avatar(@tea_users[1])) %> -# <span class="task-hide rankName"><%= @tea_users[1].try(:show_name) %></span> -# </a> -# </li> -# <% end %> -# <% if @tea_users[0] %> -# <li class="pr"> -# <img src="/images/educoder/huangguan.png" class="huangguan"/> -# <a href="/users/<%= (@tea_users[0].try(:login)) %>" class="color-dark"><%= image_tag(url_to_avatar(@tea_users[0])) %> -# <span class="task-hide rankName"><%= @tea_users[0].try(:show_name) %></span> -# </a> -# </li> -# <% end %> -# <% if @tea_users[2] %> -# <li class="mt35 pr"> -# <img src="/images/educoder/huangguan-three.png" class="huangguan"/> -# <a href="/users/<%=(@tea_users[2].try(:login)) %>" class="color-dark"><%= image_tag(url_to_avatar(@tea_users[2])) %> -# <span class="task-hide rankName"><%= @tea_users[2].try(:show_name) %></span> -# </a> -# </li> -# <% end %> -# </ul> -# <br/> -# <ul class="grade mt30"> -# <% if @tea_users.size > 3 %> -# <% @tea_users[3..@tea_users.size].each do |t_u| %> -# <li> -# <a href="/users/<%= t_u.try(:login) %>" class="color-dark"><%= image_tag(url_to_avatar(t_u)) %> -# <span class="task-hide rankName"><%= t_u.try(:show_name) %></span> -# </a> -# </li> -# <% end %> -# <% end %> -# </ul> -# </div> -# </div> -# </div> - <!--程序员排行榜--> -# <div class="pt60 pb60 mb30 pro-ranking"> -# <div class="educontent"> -# <div class="edu-txt-center"> -# <p class="color-dark edu-txt-center font-24" style="line-height: 30px">程序员排行榜</p> -# <p class="color-grey-cd font-12">PROGRAMMER RANKING</p> -# </div> -# <div class="ranking clearfix"> -# <ul class="grade color-dark"> -# <% if @stu_users[1] %> -# <li class="mt35 pr"> -# <img src="/images/educoder/huangguan-two.png" class="huangguan"/> -# <a href="/users/<%= @stu_users[1].try(:login) %>" class="color-dark"><%= image_tag(url_to_avatar(@stu_users[1])) %> -# <span class="task-hide rankName"><%= @stu_users[1].try(:show_name) %></span> -# </a> -# </li> -# <% end %> -# <% if @stu_users[0] %> -# <li class="pr"> -# <img src="/images/educoder/huangguan.png" class="huangguan"/> -# <a href="/users/<%= @stu_users[0].try(:login) %>" class="color-dark"><%= image_tag(url_to_avatar(@stu_users[0])) %> -# <span class="task-hide rankName"><%= @stu_users[0].try(:show_name) %></span> -# </a> -# </li> -# <% end %> -# <% if @stu_users[2] %> -# <li class="mt35 pr"> -# <img src="/images/educoder/huangguan-three.png" class="huangguan"/> -# <a href="/users/<%= (@stu_users[2].try(:login)) %>" class="color-dark"><%= image_tag(url_to_avatar(@stu_users[2])) %> -# <span class="task-hide rankName"><%= @stu_users[2].try(:show_name) %></span> -# </a> -# </li> -# <% end %> -# </ul> -# <br/> -# <ul class="grade mt30"> -# <% if @stu_users.size > 3 %> -# <% @stu_users[3..@stu_users.size].each do |e_u| %> -# <li> -# <a href="/users/<%= e_u.try(:login) %>" class="color-dark"><%= image_tag(url_to_avatar(e_u)) %> -# <span class="task-hide rankName"><%= e_u.try(:show_name) %></span> -# </a> -# </li> -# <% end %> -# <% end %> -# </ul> -# </div> -# </div> -# </div> </div> From ff422a309e19fd7c217674615cdc1e31f3bfddf2 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 24 Dec 2019 19:47:34 +0800 Subject: [PATCH 50/50] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E9=95=9C=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 884e32a8..92173fc3 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -396,7 +396,7 @@ class ManagementsController < ApplicationController # 搜索镜像 def mirror_search @scope = [] - if params[:q] && params[:q].lstrip.rstrip != "" + if params[:q] && params[:q].strip != "" @scope = MirrorRepository.where("name like ?", "%#{params[:q]}%").map(&:name) end respond_to do |format|