26 lines
621 B
Ruby
26 lines
621 B
Ruby
module ShixunsHelper
|
|
|
|
def had_passed_count
|
|
|
|
end
|
|
|
|
#显示项目配置菜单
|
|
def show_project_memu user
|
|
if user.allowed_to?(:edit_project, @shixun)
|
|
result = "edit_project"
|
|
elsif user.allowed_to?(:manage_members, @shixun)
|
|
result = "training_task"
|
|
elsif user.allowed_to?(:manage_versions, @shixun)
|
|
result = "manage_versions"
|
|
elsif user.allowed_to?(:manage_repository, @shixun)
|
|
result = "manage_repository"
|
|
end
|
|
result
|
|
end
|
|
|
|
def had_passed_challenge challenge
|
|
Game.where(:challenge_id => challenge.id, :status => 2).limit(3).reorder("final_score desc")
|
|
end
|
|
|
|
end
|