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 1/4] =?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 @@ <%= course.name %> <% end %> - <%= record.snapshot['members_count'].to_i %> + <%= course.students.count %> <%= record.snapshot['shixun_homework_count'].to_i || '--' %> <%= record.snapshot['valid_myshixun_count'].to_i %> <%= record.score.to_i.zero? ? '--' : record.score.to_i %> @@ -67,7 +67,7 @@ <%= course.name %> <% end %> - <%= course.members_count %> + <%= course.students.count %> <%= course['shixun_homework_count'].presence || '--' %> <%= @course_myshixun_map.fetch(course.id, '--') %> <%= score.zero? ? '--' : score %> 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 2/4] 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 3/4] =?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 4/4] 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