Repository navigation
Improve read performance with caching and memoization - #4572
Conversation
- Memoize `Crop#all_companions` and `Member#unread_count` in models - Implement instance-level memoization in `CropsHelper#crop_or_parent` - Add Rails caching for expensive aggregate queries in `Charts::CropsController` - Add fragment caching for high-impact sections on the crop show page Co-authored-by: CloCkWeRX <[email protected]>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
|
||
| def unread_count | ||
| receipts.where(is_read: false).count | ||
| @unread_count ||= receipts.where(is_read: false).count |
There was a problem hiding this comment.
@jules fix rspec ./spec/views/layouts/_header_spec.rb:95 # layouts/_header.html.haml logged in has notifications shows inbox count
There was a problem hiding this comment.
I've fixed the test by explicitly clearing the memoized @unread_count in the spec after creating a new notification. This ensures that the subsequent render call fetches the updated count from the database.
There was a problem hiding this comment.
There are still failures in
Failures:
1) layouts/_header.html.haml logged in has notifications shows inbox count
Failure/Error: expect(rendered).to have_content 'Inbox 1'
expected to find text "Inbox 1" in "Growstuff Search Record New planting New harvest Plan activity New saved seed Write new post Crops Browse Crops Seeds Plantings Harvests Community Community Map Browse Members Community Gardens Posts Forums SQHIZRSF Profile Activities Gardens Plantings Harvest Seeds Posts Inbox Sign out Growstuff Search Record New planting New harvest Plan activity New saved seed Write new post Crops Browse Crops Seeds Plantings Harvests Community Community Map Browse Members Community Gardens Posts Forums SQHIZRSF Profile Activities Gardens Plantings Harvest Seeds Posts Inbox Sign out"
# ./spec/views/layouts/_header_spec.rb:99:in 'block (4 levels) in <top (required)>'
Finished in 9.62 seconds (files took 7.82 seconds to load)
4 examples, 1 failure
Failed examples:
rspec ./spec/views/layouts/_header_spec.rb:95 # layouts/_header.html.haml logged in has notifications shows inbox count
- Reset `@unread_count` in `spec/views/layouts/_header_spec.rb` to ensure the updated notification count is rendered correctly. Co-authored-by: CloCkWeRX <[email protected]>
* Refactor Activity model to remove Elasticsearch integration (#4576) * Refactor Activity model to remove Elasticsearch integration - Removed `SearchActivities` concern and Searchkick from `Activity` model. - Implemented `Activity.homepage_records` using ActiveRecord with `DISTINCT ON` for PostgreSQL. - Updated `ActivitiesController#index` to use ActiveRecord queries with eager loading and pagination. - Added `active` scope to `Activity`. - Added unit tests for `Activity` model. - Deleted `app/models/concerns/search_activities.rb`. Co-authored-by: CloCkWeRX <[email protected]> * Fix NoMethodError: undefined method 'reindex' for class Activity - Removed all calls to `Activity.reindex` in migrations, rake tasks, and spec helpers. - These were causing failures after the removal of Searchkick from the Activity model. Co-authored-by: CloCkWeRX <[email protected]> * Fix ambiguous column id in homepage_records query - Updated `Activity.homepage_records` to use `activities.id` instead of `id` in the subquery. - This resolves the `PG::AmbiguousColumn: ERROR: column reference "id" is ambiguous` error. Co-authored-by: CloCkWeRX <[email protected]> * Fix ambiguous created_at in homepage_records query - Use `unscoped` in the subquery for `Activity.homepage_records` to bypass the default scope from `Ownable` concern. - This prevents the join with the `members` table in the subquery, which was causing `PG::AmbiguousColumn: ERROR: column reference "created_at" is ambiguous`. Co-authored-by: CloCkWeRX <[email protected]> * Complete refactoring of Activity model to remove Elasticsearch - Removed SearchActivities concern and searchkick integration. - Updated ActivitiesController#index to use ActiveRecord queries. - Implemented performant Activity.homepage_records using DISTINCT ON (PostgreSQL). - Added Activity.active scope. - Added no-op Activity.reindex (class and instance methods) for backward compatibility. - Cleaned up leftover reindex calls in rake tasks, migrations, and spec helpers. - Added unit tests for new Activity model logic. - Updated factories to include no-op reindex traits. Co-authored-by: CloCkWeRX <[email protected]> * Less eager loading --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Add funding information * Rename FUNDING.yml to .github/FUNDING.yml * Remove deprecated config.read_encrypted_secrets from production.rb (#4603) Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Add weekly harvest reminder emails and scheduled task - Added `send_harvest_reminder` preference to Member model and settings UI. - Implemented `harvest_in_next_week?` in PredictHarvest concern. - Created `harvest_reminder` email with localized templates. - Added `growstuff:send_harvest_reminders` Rake task to run weekly. - Refactored existing and new reminder tasks to use `deliver_later` for scalability. - Added unit tests for prediction logic and mailer. - Fixed a bug in the existing planting reminder task where it was using an uninitialized constant `Notifier`. Co-authored-by: CloCkWeRX <[email protected]> * Bump rubocop-capybara from 2.22.1 to 2.23.0 Bumps [rubocop-capybara](https://github.com/rubocop/rubocop-capybara) from 2.22.1 to 2.23.0. - [Release notes](https://github.com/rubocop/rubocop-capybara/releases) - [Changelog](https://github.com/rubocop/rubocop-capybara/blob/main/CHANGELOG.md) - [Commits](rubocop/rubocop-capybara@v2.22.1...v2.23.0) --- updated-dependencies: - dependency-name: rubocop-capybara dependency-version: 2.23.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * Bump axe-core-rspec from 4.11.2 to 4.11.3 Bumps [axe-core-rspec](https://github.com/dequelabs/axe-core-gems) from 4.11.2 to 4.11.3. - [Release notes](https://github.com/dequelabs/axe-core-gems/releases) - [Changelog](https://github.com/dequelabs/axe-core-gems/blob/develop/CHANGELOG.md) - [Commits](https://github.com/dequelabs/axe-core-gems/commits) --- updated-dependencies: - dependency-name: axe-core-rspec dependency-version: 4.11.3 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Fix crash during CSV export of harvests and seeds When using Searchkick with `load: false`, search results are returned as HashResponse objects which do not support model associations or standard Rails URL helpers that expect model instances. This commit updates HarvestsController and SeedsController to conditionally load ActiveRecord objects when CSV format is requested, ensuring that the export templates can access the necessary associations. Similar logic was also applied to CropsController. Additionally, a typo in the Crops CSV shaper was fixed. Co-authored-by: CloCkWeRX <[email protected]> * Associate post with crop from crop show page Co-authored-by: CloCkWeRX <[email protected]> * Fix seeds_count to correctly reference size * Change plant_before formatting method to to_fs * Merge pull request #4612 from Growstuff/fix-crops-csv-export-11894001552728801282 Fix ArgumentError in Crops CSV export * Fix crops csv export 11894001552728801282 (#4613) * Fix ArgumentError in Crops CSV export This commit fixes a crash when exporting crops to CSV, caused by accessing ActiveRecord methods and associations on Searchkick HashWrapper objects. Changes: - In CropsController#index, use `load: true` (with preloaded associations) when the request format is CSV or RSS. - In app/views/crops/index.csv.shaper, use individual `csv.cell` calls instead of `csv.cells` to correctly handle Searchkick results and explicitly access attributes. - Added a controller test to verify CSV export functionality. Co-authored-by: CloCkWeRX <[email protected]> * Mark test pending * Skip creator --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Namespaces no longer supported in sidekiq * Update to 3.4.9 * Merge pull request #4616 from Growstuff/rubocop-upgrade Update rubocop_todo.yml * Upgrade ERB * Merge pull request #4575 from Growstuff/memoize-unread-count Memoize unread messages count * Prompt for updated planting rating when harvesting (#4608) * Update planting rating when recording a harvest - Added virtual attribute `overall_rating` to `Harvest` model. - Updated `HarvestsController` to permit `overall_rating` and synchronize it to the associated `Planting`. - Added a rating range field (1-5) to the harvest form. - Added controller tests to verify that the planting rating is updated. - Refined feature tests for harvesting. Co-authored-by: CloCkWeRX <[email protected]> * I have updated the system to allow for recording a planting rating when a harvest is logged. Here is a summary of the changes: - Added a virtual attribute `overall_rating` to the `Harvest` model. - Updated `HarvestsController` to permit `overall_rating` and synchronize it to the associated `Planting`. - Added a rating range field (1-5) to the harvest form. - Added controller tests to verify that the planting rating is updated correctly. - Updated feature tests to ensure the harvest form functions as expected. Co-authored-by: CloCkWeRX <[email protected]> * Update database.yml * Apply suggestions from code review Co-authored-by: Daniel O'Connor <[email protected]> * Adjust wording * Change harvest modal * Fix tests --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Improve read performance with caching and memoization (#4572) * Improve read performance with caching and memoization - Memoize `Crop#all_companions` and `Member#unread_count` in models - Implement instance-level memoization in `CropsHelper#crop_or_parent` - Add Rails caching for expensive aggregate queries in `Charts::CropsController` - Add fragment caching for high-impact sections on the crop show page Co-authored-by: CloCkWeRX <[email protected]> * Fix header spec failure due to memoized unread_count - Reset `@unread_count` in `spec/views/layouts/_header_spec.rb` to ensure the updated notification count is rendered correctly. Co-authored-by: CloCkWeRX <[email protected]> --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Replace Sidekiq with Solid Queue (#4619) * Replace Sidekiq with Solid Queue This commit transitions the background job processing from Sidekiq to Solid Queue. Changes: - Replaced `sidekiq` gem with `solid_queue` in Gemfile. - Updated `development.rb` and `production.rb` to use `:solid_queue` as the queue adapter. - Added Solid Queue database tables via a new migration. - Configured Solid Queue in `config/queue.yml` and `config/recurring.yml`. - Integrated Solid Queue supervisor as a Puma plugin in `config/puma.rb`. - Removed separate worker process from `Procfile`. - Removed Sidekiq-specific configuration files. - Updated Gemfile.lock to support both `ruby` and `x86_64-linux` platforms. Co-authored-by: CloCkWeRX <[email protected]> * Fix regression in gemfiles --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Add crops search API endpoint (#4622) * Add crops search API endpoint - Added GET /api/v1/crops/search endpoint. - Updated CropSearchService to support additional search options. - Manually updated Swagger documentation in swagger/v1/swagger.json. - Added request specs to verify the new endpoint. Co-authored-by: CloCkWeRX <[email protected]> * Add crops search API endpoint - Added GET /api/v1/crops/search endpoint. - Updated CropSearchService to support additional search options. - Manually updated Swagger documentation in swagger/v1/swagger.json. - Added request specs to verify the new endpoint. Co-authored-by: CloCkWeRX <[email protected]> --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Revert "Replace Sidekiq with Solid Queue (#4619)" (#4620) This reverts commit 4659ac5. * Bump ip-address from 10.1.0 to 10.2.0 (#4623) Bumps [ip-address](https://github.com/beaugunderson/ip-address) from 10.1.0 to 10.2.0. - [Commits](https://github.com/beaugunderson/ip-address/commits) --- updated-dependencies: - dependency-name: ip-address dependency-version: 10.2.0 dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fast-uri from 3.1.0 to 3.1.2 Bumps [fast-uri](https://github.com/fastify/fast-uri) from 3.1.0 to 3.1.2. - [Release notes](https://github.com/fastify/fast-uri/releases) - [Commits](fastify/fast-uri@v3.1.0...v3.1.2) --- updated-dependencies: - dependency-name: fast-uri dependency-version: 3.1.2 dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> * Bump friendly_id from 5.6.0 to 5.7.0 (#4625) Bumps [friendly_id](https://github.com/norman/friendly_id) from 5.6.0 to 5.7.0. - [Release notes](https://github.com/norman/friendly_id/releases) - [Changelog](https://github.com/norman/friendly_id/blob/master/Changelog.md) - [Commits](norman/friendly_id@v5.6.0...v5.7.0) --- updated-dependencies: - dependency-name: friendly_id dependency-version: 5.7.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Cesy <[email protected]> * Bump aws-sdk-s3 from 1.220.0 to 1.221.0 (#4624) Bumps [aws-sdk-s3](https://github.com/aws/aws-sdk-ruby) from 1.220.0 to 1.221.0. - [Release notes](https://github.com/aws/aws-sdk-ruby/releases) - [Changelog](https://github.com/aws/aws-sdk-ruby/blob/version-3/gems/aws-sdk-s3/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-ruby/commits) --- updated-dependencies: - dependency-name: aws-sdk-s3 dependency-version: 1.221.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Allow collaborators to remove themselves from gardens (#4630) - Update Ability to grant destroy permission to collaborators for their own record - Add 'Leave garden' link to garden show page - Add specs for garden collaborator permissions Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Bump devise from 5.0.3 to 5.0.4 (#4629) Bumps [devise](https://github.com/heartcombo/devise) from 5.0.3 to 5.0.4. - [Release notes](https://github.com/heartcombo/devise/releases) - [Changelog](https://github.com/heartcombo/devise/blob/main/CHANGELOG.md) - [Commits](heartcombo/devise@v5.0.3...v5.0.4) --- updated-dependencies: - dependency-name: devise dependency-version: 5.0.4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump rubocop-rails from 2.34.3 to 2.35.0 (#4628) Bumps [rubocop-rails](https://github.com/rubocop/rubocop-rails) from 2.34.3 to 2.35.0. - [Release notes](https://github.com/rubocop/rubocop-rails/releases) - [Changelog](https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md) - [Commits](rubocop/rubocop-rails@v2.34.3...v2.35.0) --- updated-dependencies: - dependency-name: rubocop-rails dependency-version: 2.35.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Add Wikidata climate attributes and integration to gardens (#4627) * Add Wikidata integration for garden climate data - Add location_wikidata_id, lowest_temp_c, and highest_temp_c to gardens. - Implement WikidataService for fetching IDs and temperature properties. - Map P6591 to highest_temp_c and P7422 to lowest_temp_c with unit conversion. - Automatically populate Wikidata info on garden location change. - Add manual "Fetch Wikidata info" button and opt-in prompt to garden show page. - Update gardens_controller to permit new attributes and handle manual fetch. - Update db/schema.rb manually to include new columns and migration version. Co-authored-by: CloCkWeRX <[email protected]> * Fix migration * Improve display --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Bump selenium-webdriver from 4.43.0 to 4.44.0 (#4631) Bumps [selenium-webdriver](https://github.com/SeleniumHQ/selenium) from 4.43.0 to 4.44.0. - [Release notes](https://github.com/SeleniumHQ/selenium/releases) - [Changelog](https://github.com/SeleniumHQ/selenium/blob/trunk/rb/CHANGES) - [Commits](SeleniumHQ/selenium@selenium-4.43.0...selenium-4.44.0) --- updated-dependencies: - dependency-name: selenium-webdriver dependency-version: 4.44.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump systeminformation from 5.31.5 to 5.31.6 (#4632) Bumps [systeminformation](https://github.com/sebhildebrandt/systeminformation) from 5.31.5 to 5.31.6. - [Release notes](https://github.com/sebhildebrandt/systeminformation/releases) - [Changelog](https://github.com/sebhildebrandt/systeminformation/blob/master/CHANGELOG.md) - [Commits](sebhildebrandt/systeminformation@v5.31.5...v5.31.6) --- updated-dependencies: - dependency-name: systeminformation dependency-version: 5.31.6 dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Ensure garden creation flash prompt is rendered as HTML (#4633) Updated app/views/shared/_flash_messages.html.haml to use sanitize(content) instead of = content. This ensures that HTML content in flash messages, such as the prompt to add an activity after creating a garden, is correctly rendered even if its html_safe status is lost during session serialization. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Bump aws-sdk-s3 from 1.221.0 to 1.222.0 (#4636) Bumps [aws-sdk-s3](https://github.com/aws/aws-sdk-ruby) from 1.221.0 to 1.222.0. - [Release notes](https://github.com/aws/aws-sdk-ruby/releases) - [Changelog](https://github.com/aws/aws-sdk-ruby/blob/version-3/gems/aws-sdk-s3/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-ruby/commits) --- updated-dependencies: - dependency-name: aws-sdk-s3 dependency-version: 1.222.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump rubocop from 1.86.1 to 1.86.2 (#4634) Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.86.1 to 1.86.2. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](rubocop/rubocop@v1.86.1...v1.86.2) --- updated-dependencies: - dependency-name: rubocop dependency-version: 1.86.2 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump icalendar from 2.12.2 to 2.12.3 (#4635) Bumps [icalendar](https://github.com/icalendar/icalendar) from 2.12.2 to 2.12.3. - [Changelog](https://github.com/icalendar/icalendar/blob/main/CHANGELOG.md) - [Commits](icalendar/icalendar@v2.12.2...v2.12.3) --- updated-dependencies: - dependency-name: icalendar dependency-version: 2.12.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump faraday from 2.14.1 to 2.14.2 (#4641) Bumps [faraday](https://github.com/lostisland/faraday) from 2.14.1 to 2.14.2. - [Release notes](https://github.com/lostisland/faraday/releases) - [Changelog](https://github.com/lostisland/faraday/blob/main/CHANGELOG.md) - [Commits](lostisland/faraday@v2.14.1...v2.14.2) --- updated-dependencies: - dependency-name: faraday dependency-version: 2.14.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump oj from 3.17.0 to 3.17.1 (#4640) Bumps [oj](https://github.com/ohler55/oj) from 3.17.0 to 3.17.1. - [Release notes](https://github.com/ohler55/oj/releases) - [Changelog](https://github.com/ohler55/oj/blob/develop/CHANGELOG.md) - [Commits](ohler55/oj@v3.17.0...v3.17.1) --- updated-dependencies: - dependency-name: oj dependency-version: 3.17.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump rubocop-rails from 2.35.0 to 2.35.1 (#4642) Bumps [rubocop-rails](https://github.com/rubocop/rubocop-rails) from 2.35.0 to 2.35.1. - [Release notes](https://github.com/rubocop/rubocop-rails/releases) - [Changelog](https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md) - [Commits](rubocop/rubocop-rails@v2.35.0...v2.35.1) --- updated-dependencies: - dependency-name: rubocop-rails dependency-version: 2.35.1 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump rubocop-rails from 2.35.1 to 2.35.2 (#4643) Bumps [rubocop-rails](https://github.com/rubocop/rubocop-rails) from 2.35.1 to 2.35.2. - [Release notes](https://github.com/rubocop/rubocop-rails/releases) - [Changelog](https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md) - [Commits](rubocop/rubocop-rails@v2.35.1...v2.35.2) --- updated-dependencies: - dependency-name: rubocop-rails dependency-version: 2.35.2 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump dalli from 5.0.2 to 5.0.4 (#4639) Bumps [dalli](https://github.com/petergoldstein/dalli) from 5.0.2 to 5.0.4. - [Changelog](https://github.com/petergoldstein/dalli/blob/main/CHANGELOG.md) - [Commits](petergoldstein/dalli@v5.0.2...v5.0.4) --- updated-dependencies: - dependency-name: dalli dependency-version: 5.0.4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump aws-sdk-s3 from 1.222.0 to 1.224.0 (#4645) Bumps [aws-sdk-s3](https://github.com/aws/aws-sdk-ruby) from 1.222.0 to 1.224.0. - [Release notes](https://github.com/aws/aws-sdk-ruby/releases) - [Changelog](https://github.com/aws/aws-sdk-ruby/blob/version-3/gems/aws-sdk-s3/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-ruby/commits) --- updated-dependencies: - dependency-name: aws-sdk-s3 dependency-version: 1.224.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump bullet from 8.1.1 to 8.1.2 (#4646) Bumps [bullet](https://github.com/flyerhzm/bullet) from 8.1.1 to 8.1.2. - [Changelog](https://github.com/flyerhzm/bullet/blob/main/CHANGELOG.md) - [Commits](flyerhzm/bullet@8.1.1...8.1.2) --- updated-dependencies: - dependency-name: bullet dependency-version: 8.1.2 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump puma from 8.0.1 to 8.0.2 (#4649) Bumps [puma](https://github.com/puma/puma) from 8.0.1 to 8.0.2. - [Release notes](https://github.com/puma/puma/releases) - [Changelog](https://github.com/puma/puma/blob/main/History.md) - [Commits](puma/puma@v8.0.1...v8.0.2) --- updated-dependencies: - dependency-name: puma dependency-version: 8.0.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump rubocop-rails from 2.35.2 to 2.35.3 (#4648) Bumps [rubocop-rails](https://github.com/rubocop/rubocop-rails) from 2.35.2 to 2.35.3. - [Release notes](https://github.com/rubocop/rubocop-rails/releases) - [Changelog](https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md) - [Commits](rubocop/rubocop-rails@v2.35.2...v2.35.3) --- updated-dependencies: - dependency-name: rubocop-rails dependency-version: 2.35.3 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump dalli from 5.0.4 to 5.0.5 (#4647) Bumps [dalli](https://github.com/petergoldstein/dalli) from 5.0.4 to 5.0.5. - [Changelog](https://github.com/petergoldstein/dalli/blob/main/CHANGELOG.md) - [Commits](petergoldstein/dalli@v5.0.4...v5.0.5) --- updated-dependencies: - dependency-name: dalli dependency-version: 5.0.5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump msgpack from 1.8.0 to 1.8.1 (#4650) Bumps [msgpack](https://github.com/msgpack/msgpack-ruby) from 1.8.0 to 1.8.1. - [Changelog](https://github.com/msgpack/msgpack-ruby/blob/master/ChangeLog) - [Commits](msgpack/msgpack-ruby@v1.8.0...v1.8.1) --- updated-dependencies: - dependency-name: msgpack dependency-version: 1.8.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump oj from 3.17.1 to 3.17.3 (#4655) Bumps [oj](https://github.com/ohler55/oj) from 3.17.1 to 3.17.3. - [Release notes](https://github.com/ohler55/oj/releases) - [Changelog](https://github.com/ohler55/oj/blob/develop/CHANGELOG.md) - [Commits](ohler55/oj@v3.17.1...v3.17.3) --- updated-dependencies: - dependency-name: oj dependency-version: 3.17.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump bullet from 8.1.2 to 8.1.3 (#4654) Bumps [bullet](https://github.com/flyerhzm/bullet) from 8.1.2 to 8.1.3. - [Changelog](https://github.com/flyerhzm/bullet/blob/main/CHANGELOG.md) - [Commits](flyerhzm/bullet@8.1.2...8.1.3) --- updated-dependencies: - dependency-name: bullet dependency-version: 8.1.3 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump aws-sdk-s3 from 1.224.0 to 1.225.0 (#4653) Bumps [aws-sdk-s3](https://github.com/aws/aws-sdk-ruby) from 1.224.0 to 1.225.0. - [Release notes](https://github.com/aws/aws-sdk-ruby/releases) - [Changelog](https://github.com/aws/aws-sdk-ruby/blob/version-3/gems/aws-sdk-s3/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-ruby/commits) --- updated-dependencies: - dependency-name: aws-sdk-s3 dependency-version: 1.225.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump rubocop from 1.86.2 to 1.87.0 (#4652) Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.86.2 to 1.87.0. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](rubocop/rubocop@v1.86.2...v1.87.0) --- updated-dependencies: - dependency-name: rubocop dependency-version: 1.87.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump discard from 1.4.0 to 2.0.0 (#4651) Bumps [discard](https://github.com/jhawthorn/discard) from 1.4.0 to 2.0.0. - [Changelog](https://github.com/jhawthorn/discard/blob/master/CHANGELOG.md) - [Commits](jhawthorn/discard@v1.4.0...v2.0.0) --- updated-dependencies: - dependency-name: discard dependency-version: 2.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump rubocop-rails from 2.35.3 to 2.35.4 (#4658) Bumps [rubocop-rails](https://github.com/rubocop/rubocop-rails) from 2.35.3 to 2.35.4. - [Release notes](https://github.com/rubocop/rubocop-rails/releases) - [Changelog](https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md) - [Commits](rubocop/rubocop-rails@v2.35.3...v2.35.4) --- updated-dependencies: - dependency-name: rubocop-rails dependency-version: 2.35.4 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump rubocop-rspec from 3.9.0 to 3.10.2 Bumps [rubocop-rspec](https://github.com/rubocop/rubocop-rspec) from 3.9.0 to 3.10.2. - [Release notes](https://github.com/rubocop/rubocop-rspec/releases) - [Changelog](https://github.com/rubocop/rubocop-rspec/blob/master/CHANGELOG.md) - [Commits](rubocop/rubocop-rspec@v3.9.0...v3.10.2) --- updated-dependencies: - dependency-name: rubocop-rspec dependency-version: 3.10.2 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * Bump rubocop from 1.87.0 to 1.88.0 (#4663) Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.87.0 to 1.88.0. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](rubocop/rubocop@v1.87.0...v1.88.0) --- updated-dependencies: - dependency-name: rubocop dependency-version: 1.88.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump selenium-webdriver from 4.44.0 to 4.45.0 (#4662) Bumps [selenium-webdriver](https://github.com/SeleniumHQ/selenium) from 4.44.0 to 4.45.0. - [Release notes](https://github.com/SeleniumHQ/selenium/releases) - [Changelog](https://github.com/SeleniumHQ/selenium/blob/trunk/rb/CHANGES) - [Commits](SeleniumHQ/selenium@selenium-4.44.0...selenium-4.45.0) --- updated-dependencies: - dependency-name: selenium-webdriver dependency-version: 4.45.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump aws-sdk-s3 from 1.225.0 to 1.225.1 (#4661) Bumps [aws-sdk-s3](https://github.com/aws/aws-sdk-ruby) from 1.225.0 to 1.225.1. - [Release notes](https://github.com/aws/aws-sdk-ruby/releases) - [Changelog](https://github.com/aws/aws-sdk-ruby/blob/version-3/gems/aws-sdk-s3/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-ruby/commits) --- updated-dependencies: - dependency-name: aws-sdk-s3 dependency-version: 1.225.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump msgpack from 1.8.1 to 1.8.3 (#4660) Bumps [msgpack](https://github.com/msgpack/msgpack-ruby) from 1.8.1 to 1.8.3. - [Changelog](https://github.com/msgpack/msgpack-ruby/blob/master/ChangeLog) - [Commits](msgpack/msgpack-ruby@v1.8.1...v1.8.3) --- updated-dependencies: - dependency-name: msgpack dependency-version: 1.8.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump aws-sdk-s3 from 1.225.1 to 1.226.0 (#4666) Bumps [aws-sdk-s3](https://github.com/aws/aws-sdk-ruby) from 1.225.1 to 1.226.0. - [Release notes](https://github.com/aws/aws-sdk-ruby/releases) - [Changelog](https://github.com/aws/aws-sdk-ruby/blob/version-3/gems/aws-sdk-s3/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-ruby/commits) --- updated-dependencies: - dependency-name: aws-sdk-s3 dependency-version: 1.226.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump js-yaml from 4.1.1 to 4.2.0 (#4664) Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 4.1.1 to 4.2.0. - [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md) - [Commits](https://github.com/nodeca/js-yaml/commits) --- updated-dependencies: - dependency-name: js-yaml dependency-version: 4.2.0 dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump actions/checkout from 6 to 7 (#4667) Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v6...v7) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump faraday from 2.14.2 to 2.14.3 (#4665) Bumps [faraday](https://github.com/lostisland/faraday) from 2.14.2 to 2.14.3. - [Release notes](https://github.com/lostisland/faraday/releases) - [Changelog](https://github.com/lostisland/faraday/blob/main/CHANGELOG.md) - [Commits](lostisland/faraday@v2.14.2...v2.14.3) --- updated-dependencies: - dependency-name: faraday dependency-version: 2.14.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump rubocop-rails from 2.35.4 to 2.35.5 Bumps [rubocop-rails](https://github.com/rubocop/rubocop-rails) from 2.35.4 to 2.35.5. - [Release notes](https://github.com/rubocop/rubocop-rails/releases) - [Changelog](https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md) - [Commits](rubocop/rubocop-rails@v2.35.4...v2.35.5) --- updated-dependencies: - dependency-name: rubocop-rails dependency-version: 2.35.5 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Bump rubocop-capybara from 2.23.0 to 3.0.0 Bumps [rubocop-capybara](https://github.com/rubocop/rubocop-capybara) from 2.23.0 to 3.0.0. - [Release notes](https://github.com/rubocop/rubocop-capybara/releases) - [Changelog](https://github.com/rubocop/rubocop-capybara/blob/main/CHANGELOG.md) - [Commits](rubocop/rubocop-capybara@v2.23.0...v3.0.0) --- updated-dependencies: - dependency-name: rubocop-capybara dependency-version: 3.0.0 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * Bump haml_lint from 0.73.0 to 0.74.0 Bumps [haml_lint](https://github.com/sds/haml-lint) from 0.73.0 to 0.74.0. - [Release notes](https://github.com/sds/haml-lint/releases) - [Changelog](https://github.com/sds/haml-lint/blob/main/CHANGELOG.md) - [Commits](sds/haml-lint@v0.73.0...v0.74.0) --- updated-dependencies: - dependency-name: haml_lint dependency-version: 0.74.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * Upgrade to Rails 8.0 (#4621) * Upgrade application to Rails 8.0 - Updated Gemfile to rails ~> 8.0.0 and updated Gemfile.lock - Set config.load_defaults 8.0 in config/application.rb - Configured YAML as default_column_serializer for ActiveRecord serialization compatibility - Added Faraday 2.x error constant compatibility shim in config/initializers/faraday_patch.rb - Added Active Storage migrations and verified with db:migrate - Added Rails 8 bin/dev and bin/rubocop scripts - Maintained Ruby 3.4.9 compatibility in .ruby-version and Gemfile.lock Co-authored-by: CloCkWeRX <[email protected]> * Delete db/migrate/20241117032507_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb * Delete db/migrate/20241117032505_add_service_name_to_active_storage_blobs.active_storage.rb * Delete db/migrate/20241117032506_create_active_storage_variant_records.active_storage.rb * Delete config/initializers/faraday_patch.rb * Update schema * Fix conflicts --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Cesy <[email protected]>
This PR improves the application's read performance by implementing caching and memoization at multiple layers:
Crop#all_companions(recursive) andMember#unread_count(database count) to avoid redundant work within a single request.CropsHelper#crop_or_parentusing a memoization hash. The key includes the crop's cache key and the attribute name, ensuring correctness when multiple crops are rendered in one view.Charts::CropsControllerforsunniness,planted_from, andharvested_foractions. These perform aggregate database queries that are now cached for up to 8 hours, tied to the crop's version.app/views/crops/show.html.hamlfor the "Companions", "Varieties", "OpenFarm Data", and "Nutritional Data" sections.These changes significantly reduce database load and processing time for common read operations, particularly on the crop show page.
PR created automatically by Jules for task 6602727950375532612 started by @CloCkWeRX