move find cron for branch to correct query
This commit is contained in:
parent
d75daab82f
commit
98a75e5931
|
@ -8,5 +8,9 @@ module Travis::API::V3
|
||||||
return Models::Cron.find_by_id(id) if id
|
return Models::Cron.find_by_id(id) if id
|
||||||
raise WrongParams, 'missing cron.id'.freeze
|
raise WrongParams, 'missing cron.id'.freeze
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def find_for_branch(branch)
|
||||||
|
branch.cron
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
module Travis::API::V3
|
module Travis::API::V3
|
||||||
class Queries::Crons < Query
|
class Queries::Crons < Query
|
||||||
|
|
||||||
def find(branch)
|
|
||||||
branch.cron
|
|
||||||
end
|
|
||||||
|
|
||||||
def start(branch)
|
def start(branch)
|
||||||
raise ServerError, 'repository does not have a github_id'.freeze unless branch.repository.github_id
|
raise ServerError, 'repository does not have a github_id'.freeze unless branch.repository.github_id
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ module Travis::API::V3
|
||||||
class Services::Cron::ForBranch < Service
|
class Services::Cron::ForBranch < Service
|
||||||
|
|
||||||
def run!
|
def run!
|
||||||
Models::Cron.where(:branch_id => find(:branch, find(:repository))).first
|
query.find_for_branch(find(:branch, find(:repository)))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user