You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/lib/tasks/check_reponame.rake

28 lines
982 B

namespace :myshixun do
task check_reponame: :environment do
# 如果是选择题的则跳过否则reponame 为空的则为异常
myshixuns = Myshixun.where("repo_name is null and created_at > '2019-07-20 00:00:00'")
myshixuns.each do |myshixun|
shixun = myshixun.shixun
challenges = shixun.challenges
# 不是纯选择题的情况
6 years ago
if challenges.select{|challenge| challenge.st.to_i == 0}.size > 0
puts myshixun.games.first.try(:identifier)
end
end
end
6 years ago
task choose_repo: :environment do
myshixuns = Myshixun.where("repo_name is null and created_at > '2019-07-20 00:00:00'")
myshixuns.each do |myshixun|
shixun = myshixun.shixun
challenges = shixun.challenges
# 如果是选择题则把myshixuns表的repo_name改成-1
if challenges.select{|challenge| challenge.st.to_i == 1}.size == challenges.count
myshixun.update_attributes(:repo_name => "-1")
6 years ago
end
end
end
end