From f8a05e72d11013d98bcef813e9235d796e7052d1 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 24 Mar 2017 10:38:30 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=B8=BA0=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/challenges/_content_list.html.erb | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/app/views/challenges/_content_list.html.erb b/app/views/challenges/_content_list.html.erb index 692f73f66..2d9cef943 100644 --- a/app/views/challenges/_content_list.html.erb +++ b/app/views/challenges/_content_list.html.erb @@ -1,6 +1,9 @@
-

全部任务

<%= @challenges.count %> +

全部任务

+ <% if @challenges.count != 0 %> + <%= @challenges.count %> + <% end %> 新建阶段
@@ -22,10 +25,18 @@

- 正在挑战:<%= shixun_running @shixun %> - 完成挑战:<%= shixun_done @shixun %> - 最佳表现:<%= top_score(@shixun, challenge.position).score.to_i %>分 - 测评次数:<%= shixun_exec_total_count(@shixun, challenge.position).count %>次 + <% if shixun_running(@shixun) != 0 %> + 正在挑战:<%= shixun_running @shixun %> + <% end %> + <% if shixun_done(@shixun) != 0 %> + 完成挑战:<%= shixun_done @shixun %> + <% end %> + <% if top_score(@shixun, challenge.position).score.to_i != 0 %> + 最佳表现:<%= top_score(@shixun, challenge.position).score.to_i %>分 + <% end %> + <% if shixun_exec_total_count(@shixun, challenge.position).count != 0 %> + 测评次数:<%= shixun_exec_total_count(@shixun, challenge.position).count %>次 + <% end %>

From e8e1a899fef9b400f1f703275ce829c1508b28db Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 24 Mar 2017 10:42:51 +0800 Subject: [PATCH 2/4] current_task --- app/models/myshixun.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/myshixun.rb b/app/models/myshixun.rb index 7d42dff3c..b57c1f041 100644 --- a/app/models/myshixun.rb +++ b/app/models/myshixun.rb @@ -10,7 +10,7 @@ class Myshixun < ActiveRecord::Base # 如果都完成,则当前任务为最后一个任务 def current_task games = self.games - current_game = games.select{|game| game.status==1 || game.status==1}.first + current_game = games.select{|game| game.status==1 || game.status==0}.first if current_game.blank? current_game = games.last end From 41ddd9b2a27ace5d101de46b08ae73c083648c5f Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 24 Mar 2017 10:54:36 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 1 - app/views/challenges/show.html.erb | 4 ---- 2 files changed, 5 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index ac09aabe2..a3c27ccd3 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -46,7 +46,6 @@ class ShixunsController < ApplicationController format.html{redirect_to myshixun_path(myshixun)} end rescue Exception => e - flash[:error] = l(:notice_email_invited) raise ActiveRecord::Rollback respond_to do |format| format.html{ diff --git a/app/views/challenges/show.html.erb b/app/views/challenges/show.html.erb index 54a6ea6ca..ae47aeff4 100644 --- a/app/views/challenges/show.html.erb +++ b/app/views/challenges/show.html.erb @@ -86,10 +86,6 @@ <%= @challenge.score %>分
-
  • - 保存 - 取消 -
  • From fbce9fb02871c6ce49262e2022fe6964b3222b3e Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 24 Mar 2017 10:59:28 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index a3c27ccd3..97e906bd7 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -46,10 +46,10 @@ class ShixunsController < ApplicationController format.html{redirect_to myshixun_path(myshixun)} end rescue Exception => e + flash[:notice] = l(:notice_shixun_failed_exec)+ ":" + e.message raise ActiveRecord::Rollback respond_to do |format| format.html{ - flash[:notice] = l(:notice_shixun_failed_exec)+ ":" + e.message redirect_to shixun_path(@shixun)} end end