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

This commit is contained in:
cxt 2017-03-24 19:34:52 +08:00
commit eab2098e1e
2 changed files with 8 additions and 8 deletions

View File

@ -46,13 +46,13 @@ module ApplicationHelper
end
# 正在进行中任务
def shixun_running shixun
Myshixun.where(:parent_id => shixun, :status => 0).count
def shixun_running shixun, position
Myshixun.find_by_sql("SELECT * FROM `myshixuns` ms, `games` g where g.myshixun_id = ms.id and parent_id =#{shixun.id} and g.stage=#{position} and (g.status=0 or g.status=1);").count
end
# 已完成任务
def shixun_done shixun
Myshixun.where(:parent_id => shixun, :status => 1).count
def shixun_done shixun, position
Myshixun.find_by_sql("SELECT * FROM `myshixuns` ms, `games` g where g.myshixun_id = ms.id and parent_id =#{shixun.id} and g.stage=#{position} and g.status=2;").count
end
# 测评次数

View File

@ -27,11 +27,11 @@
<% end %>
<div class="cl"></div>
<p class="ml15 mt15 color-grey">
<% if shixun_running(@shixun) != 0 %>
<span class=" mr10">正在挑战:<%= shixun_running @shixun %></span>
<% if shixun_running(@shixun, challenge.position) != 0 %>
<span class=" mr10">正在挑战:<%= shixun_running(@shixun, challenge.position) %></span>
<% end %>
<% if shixun_done(@shixun) != 0 %>
<span class=" mr10">完成挑战:<%= shixun_done @shixun %></span>
<% if shixun_done(@shixun, challenge.position) != 0 %>
<span class=" mr10">完成挑战:<%= shixun_done(@shixun, challenge.position) %></span>
<% end %>
<% if top_score(@shixun, challenge.position).score.to_i != 0 %>
<span class=" mr10">最佳表现:<%= top_score(@shixun, challenge.position).score.to_i %>分</span>