Commit Graph
23 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
Daniel O'Connor f1acb35520 Merge pull request #4537 from Growstuff/FactoryBot/SyntaxMethods
Rubocop: FactoryBot/SyntaxMethods
2026-04-23 22:29:24 +09: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 d1f754a288 Rubocop 2022-11-08 00:23:38 +10:30
Daniel O'Connor 2db3d1bacc Various corrections 2022-11-08 00:21:23 +10:30
Daniel O'Connor 0aafaba718 Regenerate 2022-11-07 23:36:19 +10:30
Awesome Code 4cbe6ca244 Auto corrected by following Lint Ruby RSpec/DescribedClass 2020-03-03 22:33:13 +00:00
Brenda 7257b2ada1 Update with frozen literals 2020-01-10 16:50:52 +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 029beab1dd timeline service specs 2019-07-08 10:39:46 +12:00
Brenda Wallace 3d9791cb96 update spec, now that resolve_model has moved 2019-07-08 10:10:01 +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
Awesome Code 78c8fdb743 Auto corrected by following Lint Ruby RSpec/AlignLeftLetBrace 2019-04-20 09:44:42 +00:00
Awesome Code 4e07b0d620 Auto corrected by following Lint Ruby RSpec/LeadingSubject 2019-04-20 09:42:28 +00:00
Brenda Wallace 6af61d0e86 Add someone else's plantings, to ensure test is valid 2019-04-19 09:11:56 +12:00
Brenda Wallace 909ce99ab8 Merge remote-tracking branch 'origin/feature/searchkick' into feature/searchkick 2019-04-19 09:06:55 +12:00
Brenda Wallace 3829db6bc2 Specs for biasing results from elastic search 2019-04-19 09:05:53 +12:00
pozorvlakandBr3nda b3385663e8 Fix spelling of portobello
Co-Authored-By: Br3nda <brenda@wallace.net.nz>
2019-04-19 08:47:08 +12:00
Brenda Wallace e34a2d609b Plurals spec only when we have elastic search 2019-04-13 10:17:21 +12:00
Brenda Wallace 347d751935 More plurals and misspellings in search specs 2019-04-13 10:03:18 +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