竞赛作品的在线评审分布

This commit is contained in:
cxt 2016-12-30 19:35:43 +08:00
parent b92bb88985
commit 57e2ab9ff1
1 changed files with 4 additions and 1 deletions

View File

@ -3,7 +3,10 @@
namespace :contest_work_evaluation do
desc "start and end evaluation"
def get_assigned_contestant_works(judges, n, index, num)
judges[(index % num) .. ((index + n - 1) % num)]
judges = judges + judges
first_index = (index * n) % num
last_index = (index * n + n - 1) % num < first_index ? ((index * n + n - 1) % num) + num : (index * n + n - 1) % num
judges[first_index .. last_index]
end
# 获取竞赛的评委人员
def contest_judges contest