Commit Graph
46 Commits
Author SHA1 Message Date
google-labs-jules[bot]andCloCkWeRX 97e236f7e8 Convert Photos controller to plain SQL queries
- Refactored `PhotosController#index` to use ActiveRecord queries instead of Searchkick/Elasticsearch.
- Handled filtering by crop and planting via associations.
- Added eager loading for the photo owner to prevent N+1 queries.
- Decoupled the `Photo` model from Elasticsearch by removing the `SearchPhotos` concern.
- Deleted `app/models/concerns/search_photos.rb`.
- Updated controller and model specs to use standard ActiveRecord expectations.
- Cleaned up the photo factory by removing the now-obsolete `:reindex` trait.

Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com>
2026-06-23 12:16:50 +00:00
Daniel O'Connor f1acb35520 Merge pull request #4537 from Growstuff/FactoryBot/SyntaxMethods
Rubocop: FactoryBot/SyntaxMethods
2026-04-23 22:29:24 +09:30
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 d22215f870 Merge branch 'bump-ruby-3.1.x' into rubocop-safe 2022-11-08 00:32:36 +10:30
Daniel O'Connor 96147809ee Fix deprecations 2022-11-08 00:30:44 +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
Brenda Wallace 9dbf8b7c8f New robocops 2020-08-26 12:36:58 +12:00
Awesome Code 4cbe6ca244 Auto corrected by following Lint Ruby RSpec/DescribedClass 2020-03-03 22:33:13 +00:00
codefactor-io 7e30b6b6e0 [CodeFactor] Apply fixes 2020-01-03 11:28:51 +00:00
Brenda Wallace 676345815c tests for photos searching 2019-12-31 21:02:38 +13:00
Brenda Wallace a3215d2555 Rubocop fixes 2019-12-31 14:47:15 +13:00
codefactor-io e8760f9c38 [CodeFactor] Apply fixes 2019-12-20 03:33:23 +00:00
Brenda Wallace 3cd67bcc9f Fix liked photo spec 2019-07-15 11:58:46 +00:00
Brenda Wallace 60a510e73f tests the default photo changes when someone likes a photo 2019-07-15 11:58:46 +00:00
Brenda Wallace b1ebf67960 added more possible photo associations in photo model spec 2019-07-15 11:58:46 +00:00
Brenda Wallace 32695e3241 photos behave like likeable 2019-07-15 11:58:46 +00:00
Awesome Code e7713ab24b Auto corrected by following Lint Ruby RSpec/AlignRightLetBrace 2019-03-20 15:01:33 +13:00
Awesome Code 5145ead93b Auto corrected by following Lint Ruby RSpecEmptyLine 2019-03-20 15:01:33 +13:00
Awesome Code da997ae538 Auto corrected by following Lint Ruby RSpec/AlignLeftLetBrace 2019-03-20 15:01:33 +13:00
Awesome Code b7cfed1246 Auto corrected by following Lint Ruby Space 2019-02-16 13:42:20 +00:00
Brenda Wallace b7fe5e156e Fixed brackets, because ruby needs those sometimes 2019-02-05 17:18:36 +13:00
Brenda Wallace c0fdf262f4 Fixed method name in spec 2019-02-05 17:11:59 +13:00
Brenda Wallace f6ba22fb28 Fixed typo in spec 2019-02-05 17:10:34 +13:00
Brenda Wallace 9ff95506bd Spects for Photo.by_crop 2019-02-05 12:40:15 +13:00
Brenda Wallace 5c0e31721f tests for crops.by_model_type scope 2019-02-05 12:37:35 +13:00
Brenda Wallace a590b89302 Photos in spec needs to have same owner as item they link to 2018-06-04 15:29:59 +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
Awesome Code e8d9314cff Auto corrected by following Style/Lambda 2018-01-23 09:00:34 +13:00
Awesome Code dea7ce241b Auto corrected by following RSpec/EmptyLineAfterFinalLet 2018-01-23 09:00:34 +13:00
Logan Gingerich 10a8df47a9 Factorygirl to factorybot - fixes #1413 (#1425)
* FactoryGirl Changed to FactoryBot

file fix

changes based on comments received

Bundle Update on 2017-10-29

style update to align hash literal

added package-lock

* indentation fixes with rubocop

* name added to contributors
2017-11-01 15:03:31 +00:00
Brenda Wallace a6964a8f4e Update specs to join before checking member is destroyed. 2017-05-21 21:59:28 +12:00
Brenda Wallace 121d3d99fe Tests for retrieving data of deleted members 2017-05-21 11:36:07 +12:00
Mackenzie Morgan 77b7969fc9 DRY up photo & model interaction
* move stuff in models into a concern
 * create combined collection for all models that have photos
2016-11-30 00:46:58 -05:00
Brenda Wallace 62e7c716dd Removed extra empty blank lines 2016-11-26 12:06:02 +13:00
Daniel O'Connor 4b4e0cf69a $ rubocop --only HashSyntax --auto-correct
483 files inspected, 2018 offenses detected, 2018 offenses corrected
2016-05-19 15:53:11 -04:00
Miles Gould 96b0198d41 Replace remaining calls to count() with size()
The couple that aren't removed are required: for instance, there's a
Crop.count method, but no Crop.size method.
2015-07-23 23:05:39 +01:00
Mackenzie Morgan c38dc4661d basics of garden photos 2015-01-27 00:54:05 -05:00
Taylor Griffin 0ffe9adc86 tests are green 2014-11-16 21:40:43 +11:00
Taylor Griffin 7fc886f43c implement custom Sweeper class as stop gap against errors when running specs 2014-11-16 12:01:27 +11:00
Skud 2426c51951 Fixed bug in deleting unused photos
... and wow, my tests were really not testing what I thought they were
testing :-/
2014-11-11 19:29:32 +11:00
Skud 65c46c334b Delete unused photos
Make sure the models are setup so that if a photo is not used for
anything, it's removed from the system.

Also wrote a rake task (which should be run on deploy) to remove older
unused photos.
2014-09-29 09:18:28 +10:00
Miles Gould 746386731a Add metadata to photos and display it on photos/show. 2013-05-09 14:51:38 +01:00
Miles Gould 6fa94e321a Save photos. 2013-05-09 13:12:54 +01:00
Skud 5ae5e0f959 rails g scaffold Photo... 2013-05-08 20:52:35 +10:00