From 41380ddf7cd0b4fc78bbdba13e11714d74fbe0b9 Mon Sep 17 00:00:00 2001 From: Eugene Burmakin Date: Mon, 24 Mar 2025 20:58:43 +0100 Subject: [PATCH] Move some beds --- app/controllers/exports_controller.rb | 4 ---- app/models/user.rb | 2 ++ app/services/exports/create.rb | 8 ++++---- app/services/google_maps/semantic_history_parser.rb | 4 ++-- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/app/controllers/exports_controller.rb b/app/controllers/exports_controller.rb index e15ab66f..b557dc9a 100644 --- a/app/controllers/exports_controller.rb +++ b/app/controllers/exports_controller.rb @@ -37,8 +37,4 @@ class ExportsController < ApplicationController def set_export @export = current_user.exports.find(params[:id]) end - - def export_params - params.require(:export).permit(:name, :url, :status, :format) - end end diff --git a/app/models/user.rb b/app/models/user.rb index 44225162..69fecdf5 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -118,6 +118,7 @@ class User < ApplicationRecord settings.try(:[], 'maps')&.try(:[], 'url')&.strip! end + # rubocop:disable Metrics/MethodLength def import_sample_points return unless Rails.env.development? || Rails.env.production? || @@ -134,4 +135,5 @@ class User < ApplicationRecord ) ) end + # rubocop:enable Metrics/MethodLength end diff --git a/app/services/exports/create.rb b/app/services/exports/create.rb index c6ebd82f..590173ad 100644 --- a/app/services/exports/create.rb +++ b/app/services/exports/create.rb @@ -21,10 +21,10 @@ class Exports::Create export.update!(status: :completed) - create_export_finished_notification + notify_export_finished end rescue StandardError => e - create_failed_export_notification(e) + notify_export_failed(e) export.update!(status: :failed) end @@ -40,7 +40,7 @@ class Exports::Create .order(timestamp: :asc) end - def create_export_finished_notification + def notify_export_finished Notifications::Create.new( user:, kind: :info, @@ -49,7 +49,7 @@ class Exports::Create ).call end - def create_failed_export_notification(error) + def notify_export_failed(error) Notifications::Create.new( user:, kind: :error, diff --git a/app/services/google_maps/semantic_history_parser.rb b/app/services/google_maps/semantic_history_parser.rb index dd5f23d0..b8d38c5d 100644 --- a/app/services/google_maps/semantic_history_parser.rb +++ b/app/services/google_maps/semantic_history_parser.rb @@ -13,7 +13,7 @@ class GoogleMaps::SemanticHistoryParser end def call - parsed_json.each_slice(BATCH_SIZE) do |batch| + points_data.each_slice(BATCH_SIZE) do |batch| @current_index += batch.size process_batch(batch) broadcast_import_progress(import, @current_index) @@ -60,7 +60,7 @@ class GoogleMaps::SemanticHistoryParser ) end - def parsed_json + def points_data data = nil import.file.download do |f|