diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 3195873c11..401b72d402 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -513,7 +513,6 @@ Rails/RedundantActiveRecordAllMethod: - 'app/controllers/forums_controller.rb' - 'app/controllers/plant_parts_controller.rb' - 'app/controllers/scientific_names_controller.rb' - - 'app/services/openfarm_service.rb' - 'spec/features/percy/percy_spec.rb' - 'spec/models/harvest_spec.rb' @@ -630,7 +629,6 @@ Style/GlobalStdStream: Exclude: - 'config/environments/production.rb' - 'lib/tasks/gbif.rake' - - 'lib/tasks/openfarm.rake' # Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). diff --git a/app/models/ability.rb b/app/models/ability.rb index 9d80af4cff..cc8767bf00 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -78,7 +78,6 @@ def member_abilities(member) can :manage, Crop can :manage, ScientificName can :manage, AlternateName - can :openfarm, Crop can :gbif, Crop end diff --git a/app/models/concerns/open_farm_data.rb b/app/models/concerns/open_farm_data.rb deleted file mode 100644 index 64bcee0b59..0000000000 --- a/app/models/concerns/open_farm_data.rb +++ /dev/null @@ -1,72 +0,0 @@ -# frozen_string_literal: true - -module OpenFarmData - extend ActiveSupport::Concern - - included do - def of_photo - fetch_attr('main_image_path') - end - - def height - fetch_attr('height') - end - - def spread - fetch_attr('spread') - end - - def svg_icon - icon = fetch_attr('svg_icon') - return icon if icon.present? - - parent.svg_icon if parent.present? - end - - def tags_array - fetch_attr('tags_array') - end - - def description - fetch_attr('description') - end - - def row_spacing - fetch_attr('row_spacing') - end - - def common_names - fetch_attr('common_names') - end - - def binomial_name - fetch_attr('binomial_name') - end - - def sowing_method - fetch_attr('sowing_method') - end - - def main_image_path - fetch_attr('main_image_path') - end - - def sun_requirements - fetch_attr('sun_requirements') - end - - def growing_degree_days - fetch_attr('growing_degree_days') - end - - def processing_pictures - fetch_attr('processing_pictures') - end - end - - def fetch_attr(key) - return if openfarm_data.blank? - - openfarm_data.fetch('attributes', {}).fetch(key, nil) - end -end diff --git a/app/models/crop.rb b/app/models/crop.rb index 1ab135dffd..7cd6693434 100644 --- a/app/models/crop.rb +++ b/app/models/crop.rb @@ -3,7 +3,6 @@ class Crop < ApplicationRecord extend FriendlyId include PhotoCapable - include OpenFarmData include GbifData include SearchCrops diff --git a/app/services/gbif_service.rb b/app/services/gbif_service.rb index 669c6bdd49..b5b228fe69 100644 --- a/app/services/gbif_service.rb +++ b/app/services/gbif_service.rb @@ -126,12 +126,9 @@ def update_crop(crop) gbif_record = fetch(gbif_usage_key) if gbif_record.present? - # crop.update! openfarm_data: gbif_record.fetch('data', false) - # save_companions(crop, gbif_record) save_photos(crop, gbif_usage_key) else Rails.logger.debug "\tcrop not found on GBIF" - # crop.update!(openfarm_data: false) end end diff --git a/spec/helpers/photos_helper_spec.rb b/spec/helpers/photos_helper_spec.rb index 5c93d2fcf5..46c78a2195 100644 --- a/spec/helpers/photos_helper_spec.rb +++ b/spec/helpers/photos_helper_spec.rb @@ -4,7 +4,6 @@ describe PhotosHelper do let(:crop) { FactoryBot.create(:crop) } - let(:crop_photo_of) { FactoryBot.create(:photo, source: 'openfarm') } let(:crop_photo_flickr) { FactoryBot.create(:photo, source: 'flickr') } let(:garden) { FactoryBot.create(:garden) }