From fd9226c74e2fbe21c6b6963a354aa12e9cccc3c9 Mon Sep 17 00:00:00 2001 From: Ryan Romanchuk Date: Sat, 30 Dec 2023 17:41:44 -0600 Subject: [PATCH] update endpoints --- .../app/controllers/tds/batches_controller.rb | 6 +++--- personal/app/models/tds/batch.rb | 6 +++--- personal/app/services/tds/tafs/ingest.rb | 6 +----- personal/app/views/tds/pireps/_pirep.html.erb | 4 +++- personal/config/schedule.yml | 20 +++++++++---------- 5 files changed, 20 insertions(+), 22 deletions(-) diff --git a/personal/app/controllers/tds/batches_controller.rb b/personal/app/controllers/tds/batches_controller.rb index a6be8f8..daf3220 100644 --- a/personal/app/controllers/tds/batches_controller.rb +++ b/personal/app/controllers/tds/batches_controller.rb @@ -31,9 +31,9 @@ def debug def ingest if allowed_to?(:ingest?, current_user, with: BatchPolicy) - Pireps::Ingest.async_call - Metars::Ingest.async_call - Tafs::Ingest.async_call + Pireps::Ingest.call + Metars::Ingest.call + Tafs::Ingest.call redirect_to tds_batches_path, notice: 'Ingesting data...' else redirect_to tds_batches_path, notice: 'Not authorized' diff --git a/personal/app/models/tds/batch.rb b/personal/app/models/tds/batch.rb index ba15895..247a011 100644 --- a/personal/app/models/tds/batch.rb +++ b/personal/app/models/tds/batch.rb @@ -27,11 +27,11 @@ def process_batch! case report_type when 'aircraftreports' - Tds::Pireps::Process.async_call(id) + Tds::Pireps::Process.call(id) when 'metars' - Tds::Metars::Process.async_call(id) + Tds::Metars::Process.call(id) when 'tafs' - Tds::Tafs::Process.async_call(id) + Tds::Tafs::Process.call(id) end end end diff --git a/personal/app/services/tds/tafs/ingest.rb b/personal/app/services/tds/tafs/ingest.rb index 16fb998..675aeee 100644 --- a/personal/app/services/tds/tafs/ingest.rb +++ b/personal/app/services/tds/tafs/ingest.rb @@ -6,11 +6,7 @@ def report_type end def file_type - 'cache.xml' - end - - def content_type - 'text/xml' + 'cache.xml.gz' end end end diff --git a/personal/app/views/tds/pireps/_pirep.html.erb b/personal/app/views/tds/pireps/_pirep.html.erb index 2dbdebf..71ae3ff 100644 --- a/personal/app/views/tds/pireps/_pirep.html.erb +++ b/personal/app/views/tds/pireps/_pirep.html.erb @@ -85,7 +85,9 @@ Station - <%= link_to pirep.station.code, tds_station_pireps_path(pirep.station), data: {turbo_action: :advance, turbo_frame: :pireps} %> + <% if pirep.station %> + <%= link_to pirep.station&.code, tds_station_pireps_path(pirep.station), data: {turbo_action: :advance, turbo_frame: :pireps} %> + <% end %> diff --git a/personal/config/schedule.yml b/personal/config/schedule.yml index 044c56b..7167768 100644 --- a/personal/config/schedule.yml +++ b/personal/config/schedule.yml @@ -10,17 +10,17 @@ query_stats_worker: queue: "default" description: "Capture query stats" -# metars: -# cron: "*/30 * * * *" -# class: "IngestMetarsWorker" -# queue: "default" -# description: "Metars pipeline" +metars: + cron: "*/30 * * * *" + class: "IngestMetarsWorker" + queue: "default" + description: "Metars pipeline" -# tafs: -# cron: "*/30 * * * *" -# class: "IngestTafsWorker" -# queue: "default" -# description: "Tafs pipeline" +tafs: + cron: "*/30 * * * *" + class: "IngestTafsWorker" + queue: "default" + description: "Tafs pipeline" pireps: cron: "*/15 * * * *"