Make it easier to override how to save the results

This commit is contained in:
Toon Claes 2018-04-24 14:38:08 +02:00
parent d769c43396
commit 5141984747
1 changed files with 9 additions and 4 deletions

View File

@ -5,14 +5,19 @@ module RepositoryCheck
def perform(project_id)
project = Project.find(project_id)
project.update_columns(
last_repository_check_failed: !check(project),
last_repository_check_at: Time.now
)
save_result(project, !check)
end
private
def save_result(project, failure)
project.update_columns(
last_repository_check_failed: failure,
last_repository_check_at: Time.now
)
end
def check(project)
check_repo(project) && check_wiki_repo(project)
end