diff --git a/app/helpers/contests_helper.rb b/app/helpers/contests_helper.rb index 1bec615dd..154990806 100644 --- a/app/helpers/contests_helper.rb +++ b/app/helpers/contests_helper.rb @@ -1,2 +1,27 @@ module ContestsHelper + + # 判断当前用户是否为竞赛管理员 + def is_contest_manager?(user_id, contest_id) + @result = false + mem = ContestMember.where("user_id = ? and contest_id = ?",user_id, contest_id) + unless mem.blank? + @result = mem.first.roles.to_s.include?("ContestManager") ? true : false + end + return @result + end + + # 获取竞赛的管理人员 + def contest_managers contest + contest.contest_members.select{|cm| cm.roles.to_s.include?("ContestManager")} + end + + # 获取竞赛的评委人员 + def contest_judges contest + contest.contest_members.select{|cm| cm.roles.to_s.include?("Judge")} + end + + # 获取竞赛的参赛人员 + def contest_contestants contest + contest.contest_members.select{|cm| cm.roles.to_s.include?("Contestant")} + end end diff --git a/config/routes.rb b/config/routes.rb index 067662cd1..69293cc42 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -615,7 +615,7 @@ RedmineApp::Application.routes.draw do end member do - + match 'settings' , :via => [:get, :post] end resources :boards