Commit Graph
75 Commits
Author SHA1 Message Date
Brenda WallaceandClaude Sonnet 5 1c5d90230b Fix the JSON request specs, and tolerate an empty harvest param
The update helper took its hash as keywords, and the form GET sent a JSON
content type, which Rails wraps into an empty harvest param that new then
rejected. The specs are fixed, and new ignores a blank harvest param.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-22 17:42:26 +12:00
Brenda WallaceandClaude Sonnet 5 e19473205c Let garden cards record a harvest as JSON
GET /plantings/:slug/harvests/new.json gives the form's starting values
and choices; POST /harvests.json returns the garden's refreshed card, or
the validation errors as 422.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-22 17:42:26 +12:00
Daniel O'Connorandgoogle-labs-jules[bot] c7eef27f9a Fix new harvest from planting not prefilling crop (#4786)
When initializing a new harvest from a planting (via `planting_slug`
or `harvest[planting_id]`), `HarvestsController#new` now properly looks
up the planting, assigns `@harvest.planting` and `@harvest.crop` from
the planting's crop, and sets `@planting` and `@crop` instance variables
for view rendering.

Regression tests added to `HarvestsController` spec and request spec.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2026-09-20 14:10:14 +09:30
Daniel O'Connor 3edd2510d8 Merge pull request #4683 from Growstuff/refactor-harvests-remove-elasticsearch-14630838429921835504
Refactor harvests to remove Elasticsearch
2026-06-24 20:26:22 +09:30
035210197f 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 <365751+CloCkWeRX@users.noreply.github.com>

* 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 <365751+CloCkWeRX@users.noreply.github.com>

* Update database.yml

* Apply suggestions from code review

Co-authored-by: Daniel O'Connor <daniel.oconnor@gmail.com>

* Adjust wording

* Change harvest modal

* Fix tests

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2026-05-03 14:47:00 +09:30
google-labs-jules[bot]andCloCkWeRX 5ac709ffd1 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 <365751+CloCkWeRX@users.noreply.github.com>
2026-05-01 11:30:22 +00:00
Daniel O'Connorandgoogle-labs-jules[bot] 37e9860fdf Update member_slug lookup to 404 when not found (#4584)
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2026-04-27 14:19:50 +09:30
Daniel O'Connor 5f556d7b0c deprecations 2022-11-06 17:44:23 +10:30
Daniel O'Connor b24b9f82e6 Rubocop - auto corrections 2022-11-06 16:34:36 +10:30
Brenda Wallace c6988e2189 Re-instate the plantings quick actions 2020-01-05 21:31:51 +13:00
codefactor-io 7e30b6b6e0 [CodeFactor] Apply fixes 2020-01-03 11:28:51 +00:00
Brenda Wallace 8ee332edd8 update harvests controller 2019-12-28 09:20:18 +13:00
Brenda Wallace 4a2bb2342c Sorting out cancancan, copied to common parent controller 2019-12-24 11:38:30 +13:00
Brenda Wallace 6f950e685b hand loading back to cancancan 2019-12-24 10:45:02 +13:00
Brenda Wallace b730378e14 tidy up and fix specs for harvest controller 2019-12-23 09:45:35 +13:00
Brenda Wallace 42f1e61496 controller tidy up 2019-12-20 16:30:58 +13:00
Brenda Wallace 32178e2c3e Merge branch 'cache/harvests' of github.com:Br3nda/growstuff into cache/harvests 2019-12-19 21:49:37 +13:00
Brenda Wallace 5e5cdf6246 Fixing up lookup by slug 2019-12-19 21:49:18 +13:00
codefactor-io 700d2b4f30 [CodeFactor] Apply fixes to commit 3deafc0 2019-12-19 08:27:22 +00:00
Brenda Wallace 3deafc039d Loading a harvest 2019-12-19 21:26:53 +13:00
Brenda Wallace b343f89997 Photos indexed in elastic search 2019-12-11 11:42:34 +13:00
codefactor-io 18f016766a [CodeFactor] Apply fixes to commit 282791d 2019-12-09 09:20:19 +00:00
Brenda Wallace 282791d91b Pull crops and harvests from elasticsearch 2019-12-09 22:19:20 +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 4587dc711f Use to_param to make parts of the csv filename 2019-01-06 08:45:42 +13:00
Brenda Wallace 1e6c204df2 Rubcop fix up 2019-01-06 08:45:42 +13:00
Brenda Wallace 1e266a92f6 Members slug used in rotes 2019-01-06 08:45:42 +13:00
Brenda Wallace 550860178e Merge remote-tracking branch 'upstream/dev' into upgrade/rails-5 2018-09-11 16:07:30 +12:00
robotscissors dff6827761 create rss feed for harvests 2018-06-10 20:38:43 -07:00
Brenda Wallace f8a404a88b Merge remote-tracking branch 'upstream/dev' into upgrade/rails-5
Conflicts:
	Gemfile
	Gemfile.lock
	app/models/crop.rb
	app/models/forum.rb
	app/models/photo.rb
	app/models/planting.rb
	app/models/seed.rb
	db/schema.rb
	spec/models/garden_spec.rb
	spec/models/planting_spec.rb
2018-04-28 21:25:06 +12:00
Brenda Wallace 279c922b34 Rename update predictions methods to have ! 2018-04-19 13:45:29 +12:00
Brenda Wallace dd980d3f41 Harvests#edit needs to respond with something 2018-01-06 12:06:26 +13:00
Brenda Wallace 2394f4d237 One view for showing photos on an item 2017-12-17 11:40:55 +13:00
Brenda Wallace b3fd8e32d0 Fixed ordering of Harvests - don't order in scope. 2017-11-05 17:42:59 +13:00
Brenda Wallace 4cc0f77bd0 Predicting first harvest - updating medians 2017-11-05 13:42:30 +13:00
Shiny fedc7a7fb6 Merge branch 'dev' into issue-1044-account-deletion 2017-05-29 16:17:59 +12:00
Brenda Wallace efe2f49e7f More DRY Harvests controller 2017-05-29 16:17:43 +12:00
Brenda Wallace cabf849774 Deleting of users 2017-05-21 21:29:09 +12:00
Brenda Wallace c89c20e842 View harvests for a planting 2017-03-12 14:44:11 +13:00
Brenda Wallace d31739f86a Further code clarity on the harvest csv filename 2017-02-20 10:07:14 +13:00
Brenda Wallace 0f523381f0 DRY the harvest controller 2017-02-20 09:58:36 +13:00
Brenda Wallace 6d0a7ebc8f Only show plantings with overlapping date ranges on harvest options 2017-02-13 20:41:43 +13:00
Brenda Wallace 8d24ffbffb spec for harvesting from a planting 2017-02-13 17:21:11 +13:00
Brenda Wallace cce9f513db Linking existing harvests to a planting 2017-02-13 17:21:11 +13:00
Brenda Wallace c37ba9f041 Use @harvest.planting, instead of @planting 2017-02-13 17:21:11 +13:00
Brenda Wallace be2426c99f Use timezone when creating dates 2017-02-10 21:53:18 +13:00
Brenda Wallace 2f9453780e Translations for harvests controller 2017-01-22 17:28:49 +13:00
Brenda Wallace 283bb76a9e Link a harvest to a planting, and display 2017-01-04 22:45:49 +13:00
Brenda Wallace 4f465d808c We don't need to load the resource again 2016-12-07 23:54:03 +00:00
Brenda Wallace 03cb4a8dee use find_or_initialize_by 2016-12-02 00:23:46 +00:00