Commit Graph
15 Commits
Author SHA1 Message Date
google-labs-jules[bot]andCloCkWeRX e423e6ac79 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 <365751+CloCkWeRX@users.noreply.github.com>
2026-04-30 04:09:26 +00:00
google-labs-jules[bot]andCloCkWeRX 2e0c8a910d Memoize Planting-related methods for performance optimization
This commit introduces memoization to various methods in the Planting model,
PredictPlanting and PredictHarvest concerns, PlantingsHelper, and
PlantingsController.

Specifically:
- Memoized database-intensive lookups like `nearby_same_crop`, `first_harvest_date`,
  and `last_harvest_date`.
- Memoized calculated fields like `finish_predicted_at`, `expected_lifespan`,
  and `age_in_days`.
- Optimized `PlantingsHelper#transplantable_gardens_by_owner` using a hash
  to cache results per planting instance within a request.
- Applied the `defined?(@variable)` pattern where appropriate to ensure
  efficient handling of `nil` results.

These changes reduce redundant database queries and expensive calculations,
particularly during view rendering where these methods are frequently accessed.

Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com>
2026-04-28 03:07:18 +00:00
google-labs-jules[bot] ba6ec689c5 Merge pull request #4150 from Growstuff/feature/failed-plantings
Add failed status to plantings
2025-08-27 23:42:53 +09:30
Daniel O'Connor b24b9f82e6 Rubocop - auto corrections 2022-11-06 16:34:36 +10:30
Brenda 7257b2ada1 Update with frozen literals 2020-01-10 16:50:52 +13:00
Brenda Wallace 04fd1a343a Rubocop update (#2334)
* Update rubocop config

* Rubocop update - for rubocop 0.77

* [CodeFactor] Apply fixes

* rubocop fixes

* [CodeFactor] Apply fixes to commit 2826c2e
2019-12-16 22:35:33 +13:00
Brenda Wallace 6325df25b8 Make the month an int 2019-11-24 11:36:55 +13:00
Brenda Wallace 83f0182551 rubocop lint 2019-11-24 10:41:20 +13:00
Brenda Wallace 554adf234e Allow chaining on Harvest predictions method returns 2019-11-24 10:30:56 +13:00
Brenda Wallace a8a522d09e rubocop style fix 2019-11-24 10:17:55 +13:00
Brenda Wallace 0bb4dbec10 Display of planting neighbours 2019-11-24 10:15:11 +13:00
Brenda Wallace 70565c7202 show neighbouring plantings same crop
also helps see where the prediction came from
2019-11-24 09:43:25 +13:00
Brenda Wallace 09a70c4742 Predict month of harvest on perennials 2019-11-23 22:21:36 +13:00
Brenda Wallace 3ad048b7e8 Fixed linter issue, empty line after guard clause 2018-09-13 23:10:43 +12:00
Brenda Wallace b7d4781aef Split the planting&harvest predictions into files 2018-04-21 10:18:18 +12:00