Commit Graph
28 Commits
Author SHA1 Message Date
Brenda WallaceandClaude Sonnet 5 a05df8546f Colour progress bars by how the planting is getting on
Blue while growing, green while harvesting, amber when late, red when very
late, grey when finished. The track is now neutral grey so every colour
reads against it. Planting#progress_state decides, and the garden cards,
planting progress and timeline bars use it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-20 21:08:52 +12: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
Daniel O'Connor 7c081541eb Deal with age_in_days.nil? 2025-08-29 23:46:27 +09:30
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 948bb78656 Fix percentage grown 2025-08-27 13:44:44 +00:00
Daniel O'Connor 9c8ae50188 Fix https://github.com/Growstuff/growstuff/issues/3844 by avoiding future finished dates being considered past dates 2025-08-27 13:36:12 +00:00
Daniel O'Connor 067fb1671b Update predict_planting.rb 2024-07-02 23:07:48 +09:30
Daniel O'Connor cb670191d6 Merge pull request #3645 from Growstuff/planning
Planning future plantings - Minor UX changes
2024-03-01 06:27:32 +10:30
Daniel O'Connor 8593d2dfd9 Add rake task for clean up of old content (#3644) 2024-02-18 18:43:14 +10:30
Daniel O'Connor c0bcafdf51 Deal with future plantings 2024-02-18 03:33:34 +00:00
Martina Simicic b0a5223d97 Account for finished planting when counting days of life 2020-02-04 10:50:00 +13:00
Brenda bdee705b55 Update with frozen literals 2019-12-26 13:38:17 +13:00
Brenda Wallace 9c2beb304f show days of progress (#2344)
* show days of progress
* Update planting model spec to use age_in_days
2019-12-21 16:49:43 +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 91b399196a Cache some heavy queries on models 2019-12-14 14:03:01 +13:00
Brenda Wallace 1a0e30491f Removed unused methods 2019-10-24 19:04:37 +13:00
Brenda Wallace b0c8b11246 📝 Inline editing and display tidy ups (#2200)
* Inline editing and display tidy ups
2019-10-08 11:06:53 +13:00
Brenda Wallace b61c2290be Removed unnecesary helper wrapper 2019-02-04 22:15:18 +13:00
Brenda Wallace 3ad048b7e8 Fixed linter issue, empty line after guard clause 2018-09-13 23:10:43 +12:00
Brenda Wallace fc46685ab9 Renamed should_be_finshed? to late? 2018-04-23 13:44:53 +12:00
Brenda Wallace db0c60be0d Rename zombie to super_late 2018-04-23 13:33:38 +12:00
Brenda Wallace 6677f8641f If not crop lifespan data, use parent data 2018-04-21 17:40:22 +12:00
Brenda Wallace e103e6be35 Reducing complexity in planting predictions code 2018-04-21 15:32:04 +12:00
Brenda Wallace 4ad4dd0c7f Style fix up 2018-04-21 15:17:51 +12:00
Brenda Wallace a8509acd49 Zombie status needs 90 days 2018-04-21 13:02:51 +12:00
Brenda Wallace 4fe8cd566b USe finished not finished?
because some plants have finished_at in the past but haven't had their .finished set to true yet
2018-04-21 12:37:00 +12:00
Brenda Wallace f8b76e9c84 Reducing complexity in planting predictions 2018-04-21 11:12:25 +12:00
Brenda Wallace b7d4781aef Split the planting&harvest predictions into files 2018-04-21 10:18:18 +12:00