Skip to content

Commit

Permalink
Rake tasks execution time moved, linking of projects through metais c…
Browse files Browse the repository at this point in the history
…ode fixed
  • Loading branch information
tomasdrga committed Oct 4, 2024
1 parent e46e9f9 commit e338404
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
16 changes: 11 additions & 5 deletions app/jobs/link_metais_projects_and_evaluations_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@ class LinkMetaisProjectsAndEvaluationsJob < ApplicationJob

def perform
Project.find_each do |project|
code = project.metais_code
metais_project = Metais::Project.find_by(code: code)
link_metais_project(project)
end
end

private

def link_metais_project(project)
code = project.metais_code
metais_project = Metais::Project.find_by(code: code)

if metais_project.present?
project.metais_projects << metais_project
end
if metais_project.present? && !project.metais_projects.exists?(metais_project.id)
project.metais_projects << metais_project
end
end
end
2 changes: 1 addition & 1 deletion app/jobs/sync_all_topics_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ def find_indices(header_row)
end

def process_row(row, indices, sync_all)
project_metais_code = row[indices["MetaIS"]]
project_name = row[indices["Projekt"]]
project_id = row[indices["Projekt ID"]]
project_metais_code = row[indices["MetaIS"]]
platform_link = row[indices["Platforma"]]
preparation_document_id = row[indices["ID draft prípravy"]]
preparation_page_id = row[indices["ID prípravy"]]
Expand Down
7 changes: 4 additions & 3 deletions config/clock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ module Clockwork
Rake::Task[job].invoke
end

every(1.day, 'redflags:sync', at: '9:00')
every(1.day, 'redflags:sync_google_drafts', at: '3:00')
every(1.day, 'redflags:sync_sheets', at: '4:00')

every(1.day, 'metais:daily_sync', at: '10:00')
every(1.day, 'metais:daily_sync_evaluations', at: '11:00')
every(1.day, 'metais:daily_sync', at: '5:00')
every(1.day, 'metais:daily_sync_evaluations', at: '6:00')
end

0 comments on commit e338404

Please sign in to comment.