190 Commits

Author SHA1 Message Date
google-labs-jules[bot]
31c72799ea feat: Add missing public food key id to data improvement page
This change adds a new tab to the data improvement page to show crops that are missing a public food key id.

I was unable to run tests or perform frontend verification due to a known issue with the Ruby environment.
2025-12-01 11:04:01 +00:00
google-labs-jules[bot]
323c7dc3ee Optimize Data Improvement Page (#4356)
* feat: Add data improvement page to crops controller

This commit introduces a new data improvement page to the crops controller. The page displays tabbed lists of crops with missing data, allowing users to easily identify areas for data quality improvement.

The following data quality categories are included:
- Crops without photos
- Crops without descriptions
- Crops without a youtube video
- Crops without alternate names
- Crops without a scientific name with a wikidata id
- Crops without row spacing
- Crops without sun requirements
- Crops without height

All lists are sorted by planting count in descending order.

* refactor: Optimize data improvement page to load tab data on demand

This commit refactors the data improvement page to load data for each tab on demand, rather than loading all queries at once. This improves the performance of the page by only executing the query for the currently active tab.

The controller action now uses a `case` statement based on a `tab` URL parameter to execute the appropriate query. The view has been updated to pass this parameter when a tab is clicked.

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2025-12-01 19:41:28 +10:30
google-labs-jules[bot]
30e7c5d01c Merge pull request #4352 from Growstuff/add-public-food-key
feat: Add Public Food Key to Crop model
2025-12-01 18:02:33 +10:30
google-labs-jules[bot]
13a8276313 Add version tracking to crops model (#4343)
* feat: Add version tracking to Crop model

This commit introduces version tracking for the Crop model using the PaperTrail gem.

Key changes include:
- Integrating `has_paper_trail` into the `Crop` model.
- Adding a "History" section to the crop show page to display a timeline of changes for that specific crop.
- Creating a new admin page for users with the "crop_wrangler" role to view a log of all recent crop edits, creations, and deletions.
- Fixing several N+1 query performance issues by eager-loading associated `Member` records in both the `CropsController` and the new `Admin::CropsController`.
- Refactoring view logic into a shared partial to reduce code duplication.

* Add papertrail

* Admin UI

* Add papertrail DB

* Add papertrail DB

* Rearrange

* Fix permissions

* Fix permissions

* Fix UI

* Fix UI

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Daniel O'Connor <daniel.oconnor@gmail.com>
2025-11-30 14:47:46 +10:30
Daniel O'Connor
0a89ac7e28 Merge pull request #4331 from Growstuff/feature/migrate-crop-description
feat: Migrate crop description to a dedicated column
2025-11-29 14:49:24 +10:30
google-labs-jules[bot]
8f6738eefa feat: Migrate crop description to a dedicated column
This change migrates the crop description from the `openfarm_data` JSONB field to a new, dedicated `description` text column in the `crops` table.

A data migration is included to move the existing description data to the new column. The `OpenFarmData` concern is updated to remove the now-redundant `description` method.
2025-11-29 04:07:25 +00:00
google-labs-jules[bot]
73c7158454 feat: Add YouTube video to crop page
This commit introduces the following changes:

- Adds an `en_youtube_url` attribute to the `Crop` model to store a URL for an English language YouTube video.
- The `en_youtube_url` is now an editable field in the crop form.
- If a `en_youtube_url` is present for a crop, the video is embedded on the crop's show page.
- A link is added to the "Learn more" section of the crop's show page to search YouTube for "growing [crop name]".
- A helper method is added to extract the video ID from various YouTube URL formats.
- A validation is added to the `Crop` model to ensure that the `en_youtube_url` is a valid YouTube URL.
2025-11-29 03:45:23 +00:00
google-labs-jules[bot]
bc11a1b8db Merge pull request #4209 from Growstuff/extend-crop-model
Extend Crop Model and Migrate Data from OpenFarm
2025-09-07 20:03:18 +09:30
Daniel O'Connor
1657a527e9 Remove Openfarm data fetching 2025-08-27 14:20:22 +00:00
google-labs-jules[bot]
ac1463e2cf Add international alternate names for crops (#4132)
* I will add the international alternate names for the crops.

* Mark required

* Update factory

* Add placeholder

* Fix seeds

* Add language, though hardcoded to EN in most places

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Daniel O'Connor <daniel.oconnor@gmail.com>
2025-08-24 21:44:41 +09:30
Daniel O'Connor
83f2cf4a3c Require name, handle errors on crop create (#3799)
* Fix #3278 by ensuring we rebuild names on error

* Require a URL

* Require a name

* 'Only required for wrangers, and only when approving

* Re-add expectation
2024-07-23 19:44:21 +09:30
Daniel O'Connor
d542326047 Ruby 3.2: Rubocop - Rails/FilePath (#3783)
* Rails/FilePath
2024-07-13 15:13:56 +09:30
Daniel O'Connor
47ad915ab3 Remove sort form (#3679)
* Remove sort form

* Remove stale test
2024-03-17 21:56:36 +10:30
Daniel O'Connor
6102f0629b Revert 140fe7a (#3612)
* Revert 140fe7a

* Split rendering behaviour
2024-02-04 10:25:41 +10:30
Daniel O'Connor
140fe7a087 Bump searchkick, elasticsearch (#3602)
* Bump searchkick

* Bump to 7.0.0

* Fix

* Fix crop search
2024-01-26 23:01:39 +10:30
Daniel O'Connor
1f0cfa9b6c Add GBIF to our scientific names, so that our crops can associate creative commons photos (#3559)
* Add GBIF cient

* Add lookup

* Add autocomplete for GBIF lookup

* Add extra detail to scientific names

* Autocomplete

* Add routes

* Rmeove mapping

* Add autocomplete

* Update GBIF data on save

* db/schema

* Style

* Extract service

* Add concern

* Add concern

* Save photos

* Initial coverage

* Coverage

* Add coverage

* Shut up, codeclimate

* Shut up, codeclimate

* Unused

* Shut up, codeclimate

* Apply suggestions from code review

* Remove localhost

* Fix rubocop

* Fix rubocop

* Add UI links

* Add rake

* Indent

* Update Gemfile.lock

* Update lib/tasks/gbif.rake

* Update app/views/crops/_scientific_names.html.haml

* Rubocop

* Expand edit photo form

* Fix error

* Add model validations

* Skip photos without backlinks

* Fix tests

* Add photo words

* Allow blank

* Rubocop and handle invalid legacy data

* Apply suggestions from code review

* Update lib/tasks/gbif.rake
2024-01-21 13:22:25 +10:30
Daniel O'Connor
ee45b518ce Rubocop fixes (Stacked PR) (#3454)
* Fix todo

* Rubcop

* Rubocop

* Rubocop

* Rename harvests_routing_spec.rb to harvests_controller_routing_spec.rb

Making codeclimate happier

* Rename for CodeFactor: updates_routing_spec.rb to posts_controller_updates_routing_spec.rb

For codefactor

* Rename for CodeFactor: follows_routing_spec.rb to follows_controller_routing_spec.rb

* Rename for CodeFactor: forums_routing_spec.rb to forums_controller_routing_spec.rb

* Rename spec/routing/roles_routing_spec.rb to spec/routing/admin/roles_controller_routing_spec.rb

* Rename authentications_routing_spec.rb to authentications_controller_routing_spec.rb

* Rename for CodeFactor: plantings_routing_spec.rb to plantings_controller_routing_spec.rb

* Rename for CodeFactor: scientific_names_routing_spec.rb to scientific_names_controller_routing_spec.rb

* Rename for CodeFactor: seeds_routing_spec.rb to seeds_controller_routing_spec.rb

* Rename for CodeFactor: comments_routing_spec.rb to comments_controller_routing_spec.rb

* Rename for CodeFactor: garden_types_routing_spec.rb to garden_types_controller_routing_spec.rb

* Rename for CodeFactor: admin_routing_spec.rb to admin_controller_routing_spec.rb

* Rename for CodeFactor: gardens_routing_spec.rb to gardens_controller_routing_spec.rb

* Rename for CodeFactor: photos_routing_spec.rb to photos_controller_routing_spec.rb

* Rename for CodeFactor: plant_parts_routing_spec.rb to plant_parts_controller_routing_spec.rb

* Rename for CodeFactor: crops_routing_spec.rb to crops_controller_routing_spec.rb

* [CodeFactor] Apply fixes

* Rename

* Code factor bot

---------

Co-authored-by: Cesy <cesy.avon@gmail.com>
Co-authored-by: codefactor-io <support@codefactor.io>
2024-01-07 21:05:59 +10: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
0b3583e099 DRY crops controller more 2020-08-26 12:36:58 +12:00
Brenda Wallace
4906aaa180 Rename Notifer to NotifierMailer 2020-08-26 12:36:58 +12:00
codefactor-io
6c9a15f95e [CodeFactor] Apply fixes 2020-01-11 21:29:37 +00:00
codefactor-io
7e30b6b6e0 [CodeFactor] Apply fixes 2020-01-03 11:28:51 +00:00
Brenda Wallace
d46883f39b don't query for photos that we never read 2020-01-01 12:32:23 +13:00
Brenda Wallace
4940b79043 more tidy, crops controller 2019-12-28 10:08:50 +13:00
codefactor-io
f8916dfecb [CodeFactor] Apply fixes 2019-12-20 04:16:33 +00:00
Brenda Wallace
9d68ab0228 Rubocop fix of controller 2019-12-20 17:13:54 +13:00
Brenda Wallace
38e36c4a2c Merge remote-tracking branch 'upstream/dev' into cache/harvests
Conflicts:
	.rubocop_todo.yml
	app/controllers/likes_controller.rb
	app/models/concerns/crop_search.rb
	app/services/crop_search_service.rb
2019-12-19 10:28:17 +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
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
607eae2a43 Small improvements to crops controller to reduce query count 2019-12-04 21:02:33 +13:00
codefactor-io
a23963ba96 [CodeFactor] Apply fixes 2019-11-23 19:58:22 +00:00
Brenda Wallace
c0fabc7002 Reducing unnecesary and extra queries 2019-11-24 08:57:34 +13:00
Brenda Wallace
a437338961 Fix markers on crops#show map 2019-11-16 11:35:45 +13:00
Brenda Wallace
c6f4eef291 Show more results in searches 2019-10-21 16:24:31 +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
7b5698f977 👩‍🌾 Import openfarm data (#2177)
* Pull in openfarm icons, photos, info
* Truncating member location
* tidying up harvest display, and reducing duplication in css styles
* Tiny crop chip
* only show crop charts if there is data to show
* Make the styles more Growstuff
* Fixed links to openfarm
* Updating specs to cope with new photo sources
fix broken garden timeline on some pages
* Update homepage blurb
* Import crop companions
* More fluid page
* use thumbnail unless the source is flickr
* Messing with homepage
* Added crop growing_degree_days
* expect full size url on photos helper spec
* formatted dates from seeds#show
* tidy up places#show
* Move progress bar
* Quicker buttons for approve/reject crops
* Remove kaminari gem
* use crop cards on hierarchy page
* more crops on crops#index
* Wrap photo creation in transaction
* Wrap crop companions in a transaction
2019-09-28 17:23:25 +12:00
Brenda Wallace
b2d8818ae1 don't notify wranglers if there are none 2019-08-17 14:43:32 +12:00
Brenda Wallace
8faa712e07 be_success -> be_successfull
fixes a deprecation warning
2019-06-27 22:26:15 +12:00
Brenda Wallace
74e6a7cf2f Rename @matches to @crops 2019-04-08 21:39:20 +12:00
Brenda Wallace
77d1fc7347 Move crop searching specs from the crop model to the crop search service 2019-04-08 21:39:20 +12:00
Brenda Wallace
789cffeca1 Eager loading 2019-04-08 21:39:20 +12:00
Brenda Wallace
150d44ad6f named arguments for search 2019-04-08 21:39:20 +12:00
Brenda Wallace
61e0c2eb1d Swap elasticssearch for searchkick 2019-04-08 21:39:20 +12:00
Brenda Wallace
0c868d3edb Merge branch 'dev' into photos/seeds 2019-02-16 12:37:53 +13:00
Brenda Wallace
d3a542727c Fixing crop deleting and adding tests 2019-02-15 08:45:18 +13:00
Brenda Wallace
6167af700d Rubocop lint tidy 2019-02-05 12:37:09 +13:00
Brenda Wallace
9c4e649c5d Split up photos on crops#show by model type 2019-02-05 12:31:59 +13:00
Brenda Wallace
f1ad9cc3c7 Rubocop fix up 2019-02-04 20:55:04 +13:00