Commit Graph
49 Commits
Author SHA1 Message Date
Brenda WallaceandClaude Sonnet 5 23e83b1a5f Add rake tasks to pull crops and a member's data from production (#4803)
* Add rake tasks to pull crops and a member's data from production

crops:pull_from_production copies approved crops, and
members:pull_from_production copies one member's gardens, plantings and
planting photos, from growstuff.org into a local database. Both refuse to
run in a production environment.

They are built to be gentle on a server that has been struggling: one
request at a time with a pause between requests, exponential backoff
(honouring Retry-After) on timeouts, 429s and 5xx, and a hard stop rather
than endless retries. The client also stops if a server keeps sending the
same page, and will not follow a next link to another host.

Gardens and plantings come from the site's own JSON, which carries every
column; the JSON:API only exposes a garden's name, and its related
resource endpoints return the wrong records. Only the crops that a
member's plantings use are fetched. Flickr photos are stored as records
pointing at Flickr's image URLs, as on production, so nothing is
downloaded from Flickr.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Add ACTIVE_ONLY option to the member import

ACTIVE_ONLY=true leaves out the site's all=1 flag, so production lists only
the member's active gardens and current (not finished, not failed)
plantings. The server does the filtering, so it also means fewer requests,
and no crops or photos are fetched for plantings that are skipped.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-20 14:06:01 +09:30
1467ec9364 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 <365751+CloCkWeRX@users.noreply.github.com>

* Fix migration

* Improve display

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2026-05-12 18:07:35 +09:30
5ada7e7f77 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 <365751+CloCkWeRX@users.noreply.github.com>

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

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2026-05-04 18:12:36 +09:30
Daniel O'Connor fff7a14635 GBIF - optimise memory usage 2026-04-26 09:03:45 +00:00
Daniel O'Connor 468e34a551 Remove openfarm service 2025-09-01 12:56:22 +00:00
google-labs-jules[bot] 0079513b35 Merge pull request #4183 from Growstuff/feature/timeline-likes
Feature: Display likes on timeline
2025-09-01 19:51:24 +09:30
Daniel O'Connor 5be0153c74 Activities (#3646)
* Implement activities

* Add activities to timeline

* Add factory

* Add coverage

* Fix misc issues

* Activities display

* Add activities to garden and plantings

* Add activities to garden and plantings

* Add planting

* Add to planting, harvest show

* More CRUD

* More CRUD

* index

* index

* Extract card view

* Permissions

* Add edit

* Remove workaround fro vs code

* Fix title

* CSV

* CSV

* Add RSS, ical

* Extend ical slightly

* Cleanup

* Rubocop

* Remove doubled form

* Change icon

* Fix short description

* Add menus

* Put homepage widget in

* Add activity icon - MIT licenced - https://www.svgrepo.com/svg/336823/plan

* Naming

* Missing files

* Revert VS Code lag induced change

* Update app/views/home/_harvests.html.haml

* Update activities_controller.rb

* Update activities_controller.rb

* Update app/controllers/activities_controller.rb

* Update index.html.haml

* Apply suggestions from code review

* Apply suggestions from code review

* Typo

* Translation

* Apply suggestions from code review

* Update app/views/plantings/index.ics.erb

* Update app/models/activity.rb

* Update plantings_spec.rb

* Update plantings_spec.rb

* We are now rendering an extra event, so check the next one for the old behaviour
2024-03-10 11:36:24 +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 a8b8a58f33 Various rspec autocorrections 2022-11-08 00:09:50 +10:30
Daniel O'Connor b24b9f82e6 Rubocop - auto corrections 2022-11-06 16:34:36 +10:30
codefactor-io ff2d96b9bd [CodeFactor] Apply fixes 2022-11-06 05:37:42 +00:00
Daniel O'Connor 6cc711646e Rubocop complaints 2022-04-17 00:27:23 +09:30
Daniel O'Connor ad6487c7a6 Splat args 2022-04-17 00:23:06 +09:30
codefactor-io 4ff95fbac9 [CodeFactor] Apply fixes 2020-01-21 22:26:08 +13: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 8a1b8be0ef Load crops from search, without hitting the database 2020-01-01 13:47:25 +13:00
Brenda Wallace d46883f39b don't query for photos that we never read 2020-01-01 12:32:23 +13:00
codefactor-io e8760f9c38 [CodeFactor] Apply fixes 2019-12-20 03:33:23 +00: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 2ec23d6a08 Remove unnecesary mapping 2019-12-15 15:56:41 +13:00
Brenda Wallace 7c38f7eca6 Pull homepage data directly from elasticsearch (#2316)
* Pull homepage data directly from elasticsearch

* Removing non-elasticsearch options

* [CodeFactor] Apply fixes to commit c46b2e7
2019-12-09 10:03:48 +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 b1edf8542e Removed slug from query 2019-07-08 09:40:21 +12:00
Brenda Wallace 7a4312f41e Dry up timeline code 2019-07-08 09:19:26 +12:00
Brenda Wallace 03dfcdcc57 rubocop lint fix ups 2019-07-08 09:04:58 +12:00
Brenda Wallace 050dfda77e Timeline 2019-07-07 22:03:15 +12:00
Brenda Wallace e322c863b2 Removed unused arg to dbsearch 2019-04-13 10:20:33 +12:00
Brenda Wallace 174f54cb75 Linting 2019-04-13 10:13:36 +12:00
Brenda Wallace 347d751935 More plurals and misspellings in search specs 2019-04-13 10:03:18 +12:00
Brenda Wallace fa1913c8b6 Split a method to reduce the complexity 2019-04-13 09:50:36 +12:00
Brenda Wallace 01a3654d41 Working without elastic search too 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 370747390a Add default pagination to crop search service 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 7b01fcbd4b Align all the hashes 2018-12-30 15:22:29 +13:00
Brenda Wallace 857c9e9d7a whitespace fixups 2018-09-09 12:44:52 +12:00
Brenda Wallace 913ac45127 Changed query syntax for elasticsearch 2018-09-09 12:40:40 +12:00
Brenda Wallace 65b4c7dbc1 Revert "Auto corrected by following Style/StringLiterals"
This reverts commit ab56a3c6b3.
2018-02-09 07:58:47 +13:00
Awesome Code ab56a3c6b3 Auto corrected by following Style/StringLiterals 2018-02-07 10:20:26 +13:00
Brenda Wallace 302bdba150 fixes search 2017-11-01 13:57:49 +13:00
Brenda Wallace 202f557e32 Delete the old predictions code 2017-11-01 13:57:49 +13:00
Brenda Wallace 41dbf6fb1b Moved crop search out of crop model file 2017-11-01 13:57:49 +13:00
Brenda Wallace 7d6c49d8c3 Set harvest preductions on plantings 2017-11-01 13:57:49 +13:00
Brenda Wallace e21b95a353 Use floats, so the percentage calc works 2017-09-13 22:21:15 +12:00
Brenda Wallace 4bbeca9f3e only look up other plantings finishing, if we have a crop 2017-05-29 22:45:14 +12:00
Brenda Wallace 54748ac20d Removed current_date variable from planting_predictions 2017-05-29 22:45:14 +12:00
Brenda Wallace 5d97a7edac Move setting of days_before_maturity back to plant model 2017-05-29 22:45:14 +12:00
Brenda Wallace ff1c835cda Moving the planting predictions to own service 2017-05-29 22:45:14 +12:00