This commit is contained in:
parent
c02aa7a0e3
commit
01fd32fdd6
|
@ -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
|
||||
|
||||
# 测评次数
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue