Merge branch 'dev_shixun_project' of https://git.trustie.net/jacknudt/trustieforge into dev_shixun_project

This commit is contained in:
daiao 2017-03-24 12:30:29 +08:00
commit aa02211971
4 changed files with 18 additions and 12 deletions

View File

@ -46,11 +46,10 @@ class ShixunsController < ApplicationController
format.html{redirect_to myshixun_path(myshixun)}
end
rescue Exception => e
flash[:error] = l(:notice_email_invited)
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

View File

@ -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

View File

@ -1,6 +1,9 @@
<div class="task-pm-box mt20 mb20">
<div class="panel-header clearfix">
<h3 class="fl mt5">全部任务</h3><span class="btn-cir btn-cir-grey ml5 mt8 fl"><%= @challenges.count %></span>
<h3 class="fl mt5">全部任务</h3>
<% if @challenges.count != 0 %>
<span class="btn-cir btn-cir-grey ml5 mt8 fl"><%= @challenges.count %></span>
<% end %>
<a href="<%= new_shixun_challenge_path(@shixun) %>" class=" task-btn task-btn-green fr">新建阶段</a>
</div>
<div class="panel-list">
@ -22,10 +25,18 @@
</p>
<div class="cl"></div>
<p class="ml15 mt15 color-grey">
<span class=" mr10">正在挑战:<%= shixun_running @shixun %></span>
<span class=" mr10">完成挑战:<%= shixun_done @shixun %></span>
<span class=" mr10">最佳表现:<%= top_score(@shixun, challenge.position).score.to_i %>分</span>
<span class=" mr10">测评次数:<%= shixun_exec_total_count(@shixun, challenge.position).count %>次</span>
<% if shixun_running(@shixun) != 0 %>
<span class=" mr10">正在挑战:<%= shixun_running @shixun %></span>
<% end %>
<% if shixun_done(@shixun) != 0 %>
<span class=" mr10">完成挑战:<%= shixun_done @shixun %></span>
<% end %>
<% if top_score(@shixun, challenge.position).score.to_i != 0 %>
<span class=" mr10">最佳表现:<%= top_score(@shixun, challenge.position).score.to_i %>分</span>
<% end %>
<% if shixun_exec_total_count(@shixun, challenge.position).count != 0 %>
<span class=" mr10">测评次数:<%= shixun_exec_total_count(@shixun, challenge.position).count %>次</span>
<% end %>
<!--<span class=" mr10">平均表现:<%#= shixun_avg_score(@shixun, challenge.position).avg_score.to_i %>分 </span>-->
</p>
</div>

View File

@ -86,10 +86,6 @@
<%= @challenge.score %>分
</div>
</li>
<li class="clearfix">
<a href="#" class="task-btn task-btn-green fr">保存</a>
<a href="#" class="task-btn fr mr10">取消</a>
</li>
</ul>
</div>
</div>