From 8632fb47a6295e8fe73a1e6c612d2f031d08ad65 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 10 Aug 2025 01:45:45 +0000 Subject: [PATCH 1/6] feat: Add 'other source' option for seeds I've added a new option to the seeds form to allow you to specify that a seed is from a source other than your own plantings. When "other source" is chosen, it is persisted against the seed record. I also created a migration to add the `from_other_source` boolean column to the `seeds` table. --- app/assets/javascripts/application.js | 10 +++++++++ app/controllers/seeds_controller.rb | 2 +- app/helpers/seeds_helper.rb | 7 +++++++ app/models/seed.rb | 2 ++ app/views/seeds/_form.html.haml | 21 ++++++++++++------- ...09180542_add_from_other_source_to_seeds.rb | 7 +++++++ spec/features/seeds/adding_seeds_spec.rb | 16 ++++++++++++++ 7 files changed, 56 insertions(+), 9 deletions(-) create mode 100644 db/migrate/20250809180542_add_from_other_source_to_seeds.rb diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index f5438660e1..0189c20df7 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -32,3 +32,13 @@ document.addEventListener('DOMContentLoaded', function(event) { return new bootstrap.Tooltip(tooltipTrigger2); }); }); + +$(document).on('change', '[data-js-show-if-other]', function() { + var $this = $(this); + var $target = $('#' + $this.data('js-show-if-other')); + if ($this.val() === 'other') { + $target.show(); + } else { + $target.hide(); + } +}); diff --git a/app/controllers/seeds_controller.rb b/app/controllers/seeds_controller.rb index 89ab9daffe..21e383f722 100644 --- a/app/controllers/seeds_controller.rb +++ b/app/controllers/seeds_controller.rb @@ -83,7 +83,7 @@ def seed_params :days_until_maturity_min, :days_until_maturity_max, :organic, :gmo, :heirloom, :tradable_to, :slug, - :finished, :finished_at + :finished, :finished_at, :from_other_source ) end diff --git a/app/helpers/seeds_helper.rb b/app/helpers/seeds_helper.rb index e585a2348f..88127f8e14 100644 --- a/app/helpers/seeds_helper.rb +++ b/app/helpers/seeds_helper.rb @@ -1,6 +1,13 @@ # frozen_string_literal: true module SeedsHelper + def plantings_for_seed_source(member) + plantings = member.plantings.map do |planting| + [planting.crop.name, planting.id] + end + plantings << ['Other source', 'other'] + end + def display_seed_quantity(seed) if seed.quantity.nil? 'seeds' diff --git a/app/models/seed.rb b/app/models/seed.rb index 3a83174354..deba78b3e0 100644 --- a/app/models/seed.rb +++ b/app/models/seed.rb @@ -8,6 +8,8 @@ class Seed < ApplicationRecord include SearchSeeds friendly_id :seed_slug, use: %i(slugged finders) + attr_accessor :from_other_source + TRADABLE_TO_VALUES = %w(nowhere locally nationally internationally).freeze ORGANIC_VALUES = ['certified organic', 'non-certified organic', 'conventional/non-organic', 'unknown'].freeze GMO_VALUES = ['certified GMO-free', 'non-certified GMO-free', 'GMO', 'unknown'].freeze diff --git a/app/views/seeds/_form.html.haml b/app/views/seeds/_form.html.haml index b83b1f3633..6dccedf6ce 100644 --- a/app/views/seeds/_form.html.haml +++ b/app/views/seeds/_form.html.haml @@ -16,16 +16,21 @@ %li= msg .form-group.required + = f.label :source, 'Source' + = f.select :parent_planting_id, + options_for_select(plantings_for_seed_source(current_member), @seed.parent_planting_id), + { include_blank: 'Select a planting' }, + { class: 'form-control', + data: { 'js-show-if-other' => 'seed_crop_id_container' } } + %span.help-inline + Select one of your plantings, or 'Other source' + .form-group.required{ id: 'seed_crop_id_container' } = f.label :crop, 'Crop' - - if @planting - = link_to @planting, planting_path(@planting) - = f.hidden_field :parent_planting_id, value: @planting.id - - else + = auto_suggest @seed, :crop, class: 'form-control', default: @crop, required: true + %span.help-inline + Can't find what you're looking for? + = link_to "Request new crops.", new_crop_path - = auto_suggest @seed, :crop, class: 'form-control', default: @crop, required: true - %span.help-inline - Can't find what you're looking for? - = link_to "Request new crops.", new_crop_path .row .col-12.col-md-4 = f.text_field :saved_at, diff --git a/db/migrate/20250809180542_add_from_other_source_to_seeds.rb b/db/migrate/20250809180542_add_from_other_source_to_seeds.rb new file mode 100644 index 0000000000..8553df041c --- /dev/null +++ b/db/migrate/20250809180542_add_from_other_source_to_seeds.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddFromOtherSourceToSeeds < ActiveRecord::Migration[7.1] + def change + add_column :seeds, :from_other_source, :boolean + end +end diff --git a/spec/features/seeds/adding_seeds_spec.rb b/spec/features/seeds/adding_seeds_spec.rb index 01b42ea570..896dccfc3e 100644 --- a/spec/features/seeds/adding_seeds_spec.rb +++ b/spec/features/seeds/adding_seeds_spec.rb @@ -54,6 +54,22 @@ it { expect(find('.seed--description')).to have_content "It's killer." } end + describe "Adding a seed from other source" do + before do + select "Other source", from: "Source" + fill_autocomplete "crop", with: "mai" + select_from_autocomplete "maize" + within "form#new_seed" do + click_button "Save" + end + end + + it { expect(page).to have_content "Successfully added maize seed to your stash" } + it "persists the from_other_source attribute" do + expect(Seed.last.from_other_source).to be_truthy + end + end + describe "Adding a seed from crop page" do before do visit crop_path(maize) From 8d881806f7e4abe1d3101f547dc31ea40c422fc2 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 10 Aug 2025 04:26:56 +0000 Subject: [PATCH 2/6] feat: Add 'other source' option for plantings Adds a new option to the plantings show page to allow users to specify that a planting is from a source other than their own seeds. When "other source" is chosen, the planting is not associated with any seed. --- .ruby-version | 2 +- Gemfile | 1 - Gemfile.lock | 28 +--------------- app/assets/javascripts/application.js | 10 ------ app/controllers/plantings_controller.rb | 6 +++- app/controllers/seeds_controller.rb | 2 +- app/helpers/seeds_helper.rb | 7 ---- app/models/planting.rb | 2 ++ app/models/seed.rb | 2 -- app/views/plantings/show.html.haml | 1 + app/views/seeds/_form.html.haml | 21 +++++------- crowdin.yml | 22 ------------- ...09180542_add_from_other_source_to_seeds.rb | 7 ---- ...5309_add_from_other_source_to_plantings.rb | 7 ++++ lib/tasks/openfarm.rake | 14 -------- spec/features/plantings/show_spec.rb | 11 +++++++ spec/features/seeds/adding_seeds_spec.rb | 16 --------- spec/rails_helper.rb | 13 +++----- spec/tasks/openfarm_rake_spec.rb | 33 ------------------- 19 files changed, 42 insertions(+), 163 deletions(-) delete mode 100644 crowdin.yml delete mode 100644 db/migrate/20250809180542_add_from_other_source_to_seeds.rb create mode 100644 db/migrate/20250809205309_add_from_other_source_to_plantings.rb delete mode 100644 spec/tasks/openfarm_rake_spec.rb diff --git a/.ruby-version b/.ruby-version index 37d02a6e38..86fb650440 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.3.8 +3.3.7 diff --git a/Gemfile b/Gemfile index 06d4cc3184..9a296e2aca 100644 --- a/Gemfile +++ b/Gemfile @@ -175,7 +175,6 @@ group :development, :test do gem 'rubocop-rspec_rails' gem 'webrat' # provides HTML matchers for view tests - gem 'crowdin-cli' # for translations gem 'dotenv-rails' # cli utils diff --git a/Gemfile.lock b/Gemfile.lock index 6ce46e85f8..98455956ac 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -200,14 +200,6 @@ GEM concurrent-ruby (1.3.5) connection_pool (2.5.3) crass (1.0.6) - crowdin-api (1.12.0) - open-uri (>= 0.1.0, < 0.2.0) - rest-client (>= 2.0.0, < 2.2.0) - crowdin-cli (0.2.2) - crowdin-api (>= 0.2.0) - gli (>= 2.7.0) - i18n (>= 0.6.4) - rubyzip (>= 1.0.0) csv (3.3.1) csv_shaper (1.4.0) activesupport (>= 3.0.0) @@ -231,7 +223,6 @@ GEM diff-lcs (1.6.2) discard (1.4.0) activerecord (>= 4.2, < 9.0) - domain_name (0.6.20240107) dotenv (3.1.8) dotenv-rails (3.1.8) dotenv (= 3.1.8) @@ -283,8 +274,6 @@ GEM gibbon (1.2.1) httparty multi_json (>= 1.9.0) - gli (2.22.2) - ostruct globalid (1.2.1) activesupport (>= 6.1) gravatar-ultimate (2.0.0) @@ -321,9 +310,6 @@ GEM webrick highline (3.1.2) reline - http-accept (1.7.0) - http-cookie (1.0.8) - domain_name (~> 0.5) httparty (0.22.0) csv mini_mime (>= 1.0.0) @@ -405,10 +391,6 @@ GEM matrix (0.4.2) memcachier (0.0.2) method_source (1.1.0) - mime-types (3.7.0) - logger - mime-types-data (~> 3.2025, >= 3.2025.0507) - mime-types-data (3.2025.0805) mimemagic (0.4.3) nokogiri (~> 1) rake @@ -432,7 +414,6 @@ GEM timeout net-smtp (0.5.0) net-protocol - netrc (0.11.0) nio4r (2.7.4) nokogiri (1.18.9) mini_portile2 (~> 2.8.2) @@ -455,7 +436,6 @@ GEM omniauth-twitter (1.4.0) omniauth-oauth (~> 1.1) rack - open-uri (0.1.0) orm_adapter (0.5.0) ostruct (0.6.2) parallel (1.27.0) @@ -559,11 +539,6 @@ GEM responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) - rest-client (2.1.0) - http-accept (>= 1.7.0, < 2.0) - http-cookie (>= 1.0.2, < 2.0) - mime-types (>= 1.16, < 4.0) - netrc (~> 0.8) rexml (3.4.1) rouge (4.1.2) rspec (3.13.0) @@ -766,7 +741,6 @@ DEPENDENCIES chartkick coffee-rails comfortable_mexican_sofa! - crowdin-cli csv_shaper dalli database_cleaner @@ -854,7 +828,7 @@ DEPENDENCIES xmlrpc RUBY VERSION - ruby 3.3.8p144 + ruby 3.3.7p123 BUNDLED WITH 2.4.22 diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 0189c20df7..f5438660e1 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -32,13 +32,3 @@ document.addEventListener('DOMContentLoaded', function(event) { return new bootstrap.Tooltip(tooltipTrigger2); }); }); - -$(document).on('change', '[data-js-show-if-other]', function() { - var $this = $(this); - var $target = $('#' + $this.data('js-show-if-other')); - if ($this.val() === 'other') { - $target.show(); - } else { - $target.hide(); - } -}); diff --git a/app/controllers/plantings_controller.rb b/app/controllers/plantings_controller.rb index c1b3bb8fca..c2de8f4b16 100644 --- a/app/controllers/plantings_controller.rb +++ b/app/controllers/plantings_controller.rb @@ -82,6 +82,10 @@ def create end def update + if planting_params[:from_other_source] == 'true' + @planting.parent_seed_id = nil + @planting.from_other_source = true + end @planting.update(planting_params) respond_with @planting end @@ -105,7 +109,7 @@ def planting_params params[:planted_at] = parse_date(params[:planted_at]) if params[:planted_at] params.require(:planting).permit( :crop_id, :description, :garden_id, :planted_at, - :parent_seed_id, + :parent_seed_id, :from_other_source, :quantity, :sunniness, :planted_from, :finished, :finished_at ) diff --git a/app/controllers/seeds_controller.rb b/app/controllers/seeds_controller.rb index 21e383f722..89ab9daffe 100644 --- a/app/controllers/seeds_controller.rb +++ b/app/controllers/seeds_controller.rb @@ -83,7 +83,7 @@ def seed_params :days_until_maturity_min, :days_until_maturity_max, :organic, :gmo, :heirloom, :tradable_to, :slug, - :finished, :finished_at, :from_other_source + :finished, :finished_at ) end diff --git a/app/helpers/seeds_helper.rb b/app/helpers/seeds_helper.rb index 88127f8e14..e585a2348f 100644 --- a/app/helpers/seeds_helper.rb +++ b/app/helpers/seeds_helper.rb @@ -1,13 +1,6 @@ # frozen_string_literal: true module SeedsHelper - def plantings_for_seed_source(member) - plantings = member.plantings.map do |planting| - [planting.crop.name, planting.id] - end - plantings << ['Other source', 'other'] - end - def display_seed_quantity(seed) if seed.quantity.nil? 'seeds' diff --git a/app/models/planting.rb b/app/models/planting.rb index a1c469d697..8f8579f13e 100644 --- a/app/models/planting.rb +++ b/app/models/planting.rb @@ -12,6 +12,8 @@ class Planting < ApplicationRecord friendly_id :planting_slug, use: %i(slugged finders) + attr_accessor :from_other_source + # Constants SUNNINESS_VALUES = %w(sun semi-shade shade).freeze PLANTED_FROM_VALUES = [ diff --git a/app/models/seed.rb b/app/models/seed.rb index deba78b3e0..3a83174354 100644 --- a/app/models/seed.rb +++ b/app/models/seed.rb @@ -8,8 +8,6 @@ class Seed < ApplicationRecord include SearchSeeds friendly_id :seed_slug, use: %i(slugged finders) - attr_accessor :from_other_source - TRADABLE_TO_VALUES = %w(nowhere locally nationally internationally).freeze ORGANIC_VALUES = ['certified organic', 'non-certified organic', 'conventional/non-organic', 'unknown'].freeze GMO_VALUES = ['certified GMO-free', 'non-certified GMO-free', 'GMO', 'unknown'].freeze diff --git a/app/views/plantings/show.html.haml b/app/views/plantings/show.html.haml index f050d1a4cf..d7edb2b7db 100644 --- a/app/views/plantings/show.html.haml +++ b/app/views/plantings/show.html.haml @@ -20,6 +20,7 @@ Is this from one of these plantings? - @matching_seeds.each do |seed| = f.radio_button :parent_seed_id, seed.id, label: seed + = f.radio_button :parent_seed_id, 'other', label: 'Other source' = f.submit "save", class: 'btn btn-sm' .planting diff --git a/app/views/seeds/_form.html.haml b/app/views/seeds/_form.html.haml index 6dccedf6ce..b83b1f3633 100644 --- a/app/views/seeds/_form.html.haml +++ b/app/views/seeds/_form.html.haml @@ -16,21 +16,16 @@ %li= msg .form-group.required - = f.label :source, 'Source' - = f.select :parent_planting_id, - options_for_select(plantings_for_seed_source(current_member), @seed.parent_planting_id), - { include_blank: 'Select a planting' }, - { class: 'form-control', - data: { 'js-show-if-other' => 'seed_crop_id_container' } } - %span.help-inline - Select one of your plantings, or 'Other source' - .form-group.required{ id: 'seed_crop_id_container' } = f.label :crop, 'Crop' - = auto_suggest @seed, :crop, class: 'form-control', default: @crop, required: true - %span.help-inline - Can't find what you're looking for? - = link_to "Request new crops.", new_crop_path + - if @planting + = link_to @planting, planting_path(@planting) + = f.hidden_field :parent_planting_id, value: @planting.id + - else + = auto_suggest @seed, :crop, class: 'form-control', default: @crop, required: true + %span.help-inline + Can't find what you're looking for? + = link_to "Request new crops.", new_crop_path .row .col-12.col-md-4 = f.text_field :saved_at, diff --git a/crowdin.yml b/crowdin.yml deleted file mode 100644 index 94a0bed3fb..0000000000 --- a/crowdin.yml +++ /dev/null @@ -1,22 +0,0 @@ -# Hi there! -# -# This is a configuration file for the Crowdin CLI. -# You'll need to replace the placeholder project_id with your actual -# project ID from CrowdIn. -# -# For more information, see the Crowdin CLI documentation: -# https://support.crowdin.com/enterprise/cli-v3/ -# -project_id: "your-project-id" -api_token_env: "CROWDIN_API_TOKEN" -base_path: "." - -files: - - source: '/config/locales/en.yml' - translation: '/config/locales/%two_letters_code%.yml' - # The 'ignore' property is used to exclude files from processing. - # We are ignoring the existing Japanese translation file. - ignore: - - '/config/locales/ja.yml' - - source: '/config/locales/*.en.yml' - translation: '/config/locales/%file_name%.%two_letters_code%.yml' diff --git a/db/migrate/20250809180542_add_from_other_source_to_seeds.rb b/db/migrate/20250809180542_add_from_other_source_to_seeds.rb deleted file mode 100644 index 8553df041c..0000000000 --- a/db/migrate/20250809180542_add_from_other_source_to_seeds.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -class AddFromOtherSourceToSeeds < ActiveRecord::Migration[7.1] - def change - add_column :seeds, :from_other_source, :boolean - end -end diff --git a/db/migrate/20250809205309_add_from_other_source_to_plantings.rb b/db/migrate/20250809205309_add_from_other_source_to_plantings.rb new file mode 100644 index 0000000000..5a13907c47 --- /dev/null +++ b/db/migrate/20250809205309_add_from_other_source_to_plantings.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddFromOtherSourceToPlantings < ActiveRecord::Migration[7.1] + def change + add_column :plantings, :from_other_source, :boolean + end +end diff --git a/lib/tasks/openfarm.rake b/lib/tasks/openfarm.rake index f49857d4dc..92ca9cc399 100644 --- a/lib/tasks/openfarm.rake +++ b/lib/tasks/openfarm.rake @@ -8,18 +8,4 @@ namespace :openfarm do Rails.logger = Logger.new(STDOUT) OpenfarmService.new.import! end - - desc "Delete all pictures with source OpenFarm" - task delete_pictures: :environment do - puts "Deleting pictures with source OpenFarm..." - photos_to_delete = Photo.where(source: 'openfarm') - count = photos_to_delete.count - photos_to_delete.each do |photo| - photo.associations.each do |photo_association| - photo_association.delete - end - photo.delete - end - puts "Deleted #{count} pictures." - end end diff --git a/spec/features/plantings/show_spec.rb b/spec/features/plantings/show_spec.rb index e9c69c7867..9299907589 100644 --- a/spec/features/plantings/show_spec.rb +++ b/spec/features/plantings/show_spec.rb @@ -92,6 +92,17 @@ it { expect(page).to have_text 'Parent seed' } it { expect(page).to have_link href: planting_path(planting) } end + + describe 'selecting other source' do + before do + choose 'Other source' + click_button 'save' + end + + it "hides the seed source question" do + expect(page).to have_no_text 'Is this from one of these plantings?' + end + end end end end diff --git a/spec/features/seeds/adding_seeds_spec.rb b/spec/features/seeds/adding_seeds_spec.rb index 896dccfc3e..01b42ea570 100644 --- a/spec/features/seeds/adding_seeds_spec.rb +++ b/spec/features/seeds/adding_seeds_spec.rb @@ -54,22 +54,6 @@ it { expect(find('.seed--description')).to have_content "It's killer." } end - describe "Adding a seed from other source" do - before do - select "Other source", from: "Source" - fill_autocomplete "crop", with: "mai" - select_from_autocomplete "maize" - within "form#new_seed" do - click_button "Save" - end - end - - it { expect(page).to have_content "Successfully added maize seed to your stash" } - it "persists the from_other_source attribute" do - expect(Seed.last.from_other_source).to be_truthy - end - end - describe "Adding a seed from crop page" do before do visit crop_path(maize) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index bd64cd3336..3c17087a97 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -15,13 +15,13 @@ require 'axe-capybara' require 'axe-rspec' +# TODO: We may want to trial options.add_argument('--disable-dev-shm-usage') ### optional + # Required for running in the dev container Capybara.register_driver :selenium_chrome_customised_headless do |app| options = Selenium::WebDriver::Options.chrome options.add_argument("--headless") options.add_argument("--no-sandbox") - options.add_argument("--window-size=1920,1080") - options.add_argument("--disable-dev-shm-usage") # driver = Selenium::WebDriver.for :chrome, options: options @@ -120,8 +120,8 @@ # Prevent Poltergeist from fetching external URLs during feature tests config.before(:each, :js) do # TODO: Why are we setting this page size then straight afterwards, maximising? - width = 1920 - height = 1080 + width = 1280 + height = 1280 Capybara.current_session.driver.browser.manage.window.resize_to(width, height) if page.driver.browser.respond_to?(:url_blacklist) @@ -132,9 +132,6 @@ ] end - # Historically, we wanted to .maximize; but this actually undoes the resize_to step above - # with chrome headless - # page.driver.browser.manage.window.maximize if page.driver.browser.respond_to?(:manage) - # puts "Maximized window size: #{page.driver.browser.manage.window.size}" + page.driver.browser.manage.window.maximize if page.driver.browser.respond_to?(:manage) end end diff --git a/spec/tasks/openfarm_rake_spec.rb b/spec/tasks/openfarm_rake_spec.rb deleted file mode 100644 index 56681a43ee..0000000000 --- a/spec/tasks/openfarm_rake_spec.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' -require 'rake' - -describe 'openfarm:delete_pictures' do - before(:all) do - Rails.application.load_tasks - end - - # We need to do this because Rake tasks normally output to STDOUT, but we - # don't want to clutter up the test output. - before(:each) do - $stdout = StringIO.new - end - - after(:each) do - $stdout = STDOUT - end - - it 'deletes pictures with source OpenFarm' do - create(:photo, source: 'OpenFarm') - create(:photo, source: 'flickr') - - expect(Photo.where(source: 'OpenFarm').count).to eq(1) - expect(Photo.where(source: 'flickr').count).to eq(1) - - Rake::Task['openfarm:delete_pictures'].invoke - - expect(Photo.where(source: 'OpenFarm').count).to eq(0) - expect(Photo.where(source: 'flickr').count).to eq(1) - end -end From 9e5d2ee1f3a1d94147b85025ce936ad1f931d0ce Mon Sep 17 00:00:00 2001 From: Daniel O'Connor Date: Mon, 1 Sep 2025 11:42:29 +0000 Subject: [PATCH 3/6] Restore --- .ruby-version | 2 +- Gemfile | 7 +++---- Gemfile.lock | 33 ++++++++++++++++++++++++++------- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/.ruby-version b/.ruby-version index 86fb650440..37d02a6e38 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.3.7 +3.3.8 diff --git a/Gemfile b/Gemfile index 229f9dfefb..b572e86cd6 100644 --- a/Gemfile +++ b/Gemfile @@ -174,6 +174,7 @@ group :development, :test do gem 'rubocop-rspec_rails' gem 'webrat' # provides HTML matchers for view tests + gem 'crowdin-cli' # for translations gem 'dotenv-rails' # cli utils @@ -187,18 +188,16 @@ end group :test do gem 'axe-core-capybara' gem 'axe-core-rspec' + gem "percy-capybara", "~> 5.0.0" gem 'rails-controller-testing' + gem "rspec-rebound" gem 'selenium-webdriver' gem 'timecop' gem 'vcr' - gem "rspec-rebound" - gem "percy-capybara", "~> 5.0.0" end group :travis do gem 'platform-api' end - - gem "i18n_data", "~> 1.1" diff --git a/Gemfile.lock b/Gemfile.lock index 513f32cebe..45a47fbe25 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -200,6 +200,14 @@ GEM concurrent-ruby (1.3.5) connection_pool (2.5.3) crass (1.0.6) + crowdin-api (1.12.0) + open-uri (>= 0.1.0, < 0.2.0) + rest-client (>= 2.0.0, < 2.2.0) + crowdin-cli (0.2.2) + crowdin-api (>= 0.2.0) + gli (>= 2.7.0) + i18n (>= 0.6.4) + rubyzip (>= 1.0.0) csv (3.3.1) csv_shaper (1.4.0) activesupport (>= 3.0.0) @@ -223,6 +231,7 @@ GEM diff-lcs (1.6.2) discard (1.4.0) activerecord (>= 4.2, < 9.0) + domain_name (0.6.20240107) dotenv (3.1.8) dotenv-rails (3.1.8) dotenv (= 3.1.8) @@ -274,6 +283,8 @@ GEM gibbon (1.2.1) httparty multi_json (>= 1.9.0) + gli (2.22.2) + ostruct globalid (1.2.1) activesupport (>= 6.1) gravatar-ultimate (2.0.0) @@ -310,6 +321,9 @@ GEM webrick highline (3.1.2) reline + http-accept (1.7.0) + http-cookie (1.0.8) + domain_name (~> 0.5) httparty (0.22.0) csv mini_mime (>= 1.0.0) @@ -393,12 +407,15 @@ GEM matrix (0.4.2) memcachier (0.0.2) method_source (1.1.0) + mime-types (3.7.0) + logger + mime-types-data (~> 3.2025, >= 3.2025.0507) + mime-types-data (3.2025.0826) mimemagic (0.4.3) nokogiri (~> 1) rake mini_magick (4.12.0) mini_mime (1.1.5) - mini_portile2 (2.8.9) minitest (5.25.5) moneta (1.0.0) msgpack (1.8.0) @@ -416,10 +433,8 @@ GEM timeout net-smtp (0.5.1) net-protocol + netrc (0.11.0) nio4r (2.7.4) - nokogiri (1.18.9) - mini_portile2 (~> 2.8.2) - racc (~> 1.4) nokogiri (1.18.9-x86_64-linux-gnu) racc (~> 1.4) oauth (0.5.6) @@ -444,7 +459,6 @@ GEM racc percy-capybara (5.0.0) capybara (>= 3) - pg (1.6.1) pg (1.6.1-x86_64-linux) platform-api (3.8.0) heroics (~> 0.1.1) @@ -539,6 +553,11 @@ GEM responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) + rest-client (2.1.0) + http-accept (>= 1.7.0, < 2.0) + http-cookie (>= 1.0.2, < 2.0) + mime-types (>= 1.16, < 4.0) + netrc (~> 0.8) rexml (3.4.1) rouge (4.1.2) rspec (3.13.0) @@ -720,7 +739,6 @@ GEM zeitwerk (2.7.3) PLATFORMS - ruby x86_64-linux DEPENDENCIES @@ -745,6 +763,7 @@ DEPENDENCIES chartkick coffee-rails comfortable_mexican_sofa! + crowdin-cli csv_shaper dalli database_cleaner @@ -833,7 +852,7 @@ DEPENDENCIES xmlrpc RUBY VERSION - ruby 3.3.7p123 + ruby 3.3.8p144 BUNDLED WITH 2.4.22 From b96686306363671f9424c2fdb97fc0ed929cd2a1 Mon Sep 17 00:00:00 2001 From: Daniel O'Connor Date: Mon, 1 Sep 2025 12:32:25 +0000 Subject: [PATCH 4/6] Re-add crowdin --- crowdin.yml | 22 ++++++++++++++++++++++ db/schema.rb | 1 + 2 files changed, 23 insertions(+) create mode 100644 crowdin.yml diff --git a/crowdin.yml b/crowdin.yml new file mode 100644 index 0000000000..a51158d497 --- /dev/null +++ b/crowdin.yml @@ -0,0 +1,22 @@ +# Hi there! +# +# This is a configuration file for the Crowdin CLI. +# You'll need to replace the placeholder project_id with your actual +# project ID from CrowdIn. +# +# For more information, see the Crowdin CLI documentation: +# https://support.crowdin.com/enterprise/cli-v3/ +# +project_id: "your-project-id" +api_token_env: "CROWDIN_API_TOKEN" +base_path: "." + +files: + - source: '/config/locales/en.yml' + translation: '/config/locales/%two_letters_code%.yml' + # The 'ignore' property is used to exclude files from processing. + # We are ignoring the existing Japanese translation file. + ignore: + - '/config/locales/ja.yml' + - source: '/config/locales/*.en.yml' + translation: '/config/locales/%file_name%.%two_letters_code%.yml' \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index 6c279b9a91..ddef3b5f03 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -586,6 +586,7 @@ t.integer "harvests_count", default: 0 t.integer "likes_count", default: 0 t.boolean "failed", default: false, null: false + t.boolean "from_other_source" t.index ["crop_id"], name: "index_plantings_on_crop_id" t.index ["garden_id"], name: "index_plantings_on_garden_id" t.index ["owner_id"], name: "index_plantings_on_owner_id" From e9de01fc6552d194a097dfc238b82336c96fbafe Mon Sep 17 00:00:00 2001 From: Daniel O'Connor Date: Mon, 1 Sep 2025 12:33:49 +0000 Subject: [PATCH 5/6] Update --- spec/rails_helper.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 3c17087a97..64e1a14ae8 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -15,8 +15,6 @@ require 'axe-capybara' require 'axe-rspec' -# TODO: We may want to trial options.add_argument('--disable-dev-shm-usage') ### optional - # Required for running in the dev container Capybara.register_driver :selenium_chrome_customised_headless do |app| options = Selenium::WebDriver::Options.chrome @@ -120,8 +118,8 @@ # Prevent Poltergeist from fetching external URLs during feature tests config.before(:each, :js) do # TODO: Why are we setting this page size then straight afterwards, maximising? - width = 1280 - height = 1280 + width = 1920 + height = 1080 Capybara.current_session.driver.browser.manage.window.resize_to(width, height) if page.driver.browser.respond_to?(:url_blacklist) @@ -132,6 +130,9 @@ ] end - page.driver.browser.manage.window.maximize if page.driver.browser.respond_to?(:manage) + # Historically, we wanted to .maximize; but this actually undoes the resize_to step above + # with chrome headless + # page.driver.browser.manage.window.maximize if page.driver.browser.respond_to?(:manage) + # puts "Maximized window size: #{page.driver.browser.manage.window.size}" end end From b9b04b14946c88752d73319a339ee36deb6e588b Mon Sep 17 00:00:00 2001 From: Daniel O'Connor Date: Mon, 1 Sep 2025 22:04:23 +0930 Subject: [PATCH 6/6] Update crowdin.yml --- crowdin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crowdin.yml b/crowdin.yml index a51158d497..94a0bed3fb 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -19,4 +19,4 @@ files: ignore: - '/config/locales/ja.yml' - source: '/config/locales/*.en.yml' - translation: '/config/locales/%file_name%.%two_letters_code%.yml' \ No newline at end of file + translation: '/config/locales/%file_name%.%two_letters_code%.yml'