mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-07-30 09:17:44 -04:00
release88 (#4688)
* Bump actions/cache from 5 to 6 Bumps [actions/cache](https://github.com/actions/cache) from 5 to 6. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v5...v6) --- updated-dependencies: - dependency-name: actions/cache dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Bump axe-core-rspec from 4.11.3 to 4.12.0 Bumps [axe-core-rspec](https://github.com/dequelabs/axe-core-gems) from 4.11.3 to 4.12.0. - [Release notes](https://github.com/dequelabs/axe-core-gems/releases) - [Changelog](https://github.com/dequelabs/axe-core-gems/blob/develop/CHANGELOG.md) - [Commits](https://github.com/dequelabs/axe-core-gems/compare/v4.11.3...v4.12.0) --- updated-dependencies: - dependency-name: axe-core-rspec dependency-version: 4.12.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Merge pull request #4683 from Growstuff/refactor-harvests-remove-elasticsearch-14630838429921835504 Refactor harvests to remove Elasticsearch * Refactor Seeds to remove Elasticsearch dependency (#4684) * Refactor Seeds to remove Elasticsearch dependency This commit refactors the `SeedsController` and `Seed` model to remove dependency on Elasticsearch and Searchkick. Key changes: - Removed `SearchSeeds` concern from the `Seed` model. - Reimplemented `Seed.homepage_records` using ActiveRecord. - Refactored `SeedsController#index` to use ActiveRecord for filtering, eager loading, and pagination. - Deleted `app/models/concerns/search_seeds.rb`. - Updated relevant specs to remove Searchkick-specific tags and setup. Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com> * Remove Seed.reindex * Remove trait * Fix tests --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Refactor Plantings to remove Elasticsearch dependency (#4686) * Refactor Plantings to remove Elasticsearch dependency This commit refactors the Plantings controller, model, and views to use ActiveRecord instead of Searchkick/Elasticsearch. Key changes: - Refactored `PlantingsController#index` to use an ActiveRecord-based `plantings` method. - Moved `homepage_records` logic from `SearchPlantings` concern to the `Planting` model using ActiveRecord scopes. - Removed `SearchPlantings` concern and deleted the file. - Updated `home/_plantings.html.haml` and `plantings/index.rss.haml` to use dot notation for `Planting` object attributes. - Updated specs to remove Searchkick-related setup and assertions. Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com> * Fix Planting.reindex * Fix test * Mark test pending --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Fix plantings ICS feed regression and enable request spec (#4687) * Fix plantings ICS feed regression and enable request spec - Update `app/views/plantings/index.ics.erb` to use ActiveRecord method calls instead of hash bracket access. - Enable `spec/requests/plantings_spec.rb` and update it to account for mirrored harvest events. - Add `config/initializers/faraday_patch.rb` to fix Searchkick/Faraday 2.x compatibility issues. Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com> * Delete config/initializers/faraday_patch.rb * Apply suggestion from @CloCkWeRX * Apply suggestions from code review Co-authored-by: Daniel O'Connor <daniel.oconnor@gmail.com> * Apply suggestion from @CloCkWeRX --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Block Semrush crawler in Rack Attack initializer Added a blocklist entry for the Semrush crawler to prevent abusive requests. * Bump sitemap_generator from 6.3.0 to 7.0.2 Bumps [sitemap_generator](https://github.com/kjvarga/sitemap_generator) from 6.3.0 to 7.0.2. - [Changelog](https://github.com/kjvarga/sitemap_generator/blob/master/CHANGES.md) - [Commits](https://github.com/kjvarga/sitemap_generator/compare/v6.3.0...v7.0.2) --- updated-dependencies: - dependency-name: sitemap_generator dependency-version: 7.0.2 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Bump carrierwave from 3.0.7 to 3.1.3 Bumps [carrierwave](https://github.com/carrierwaveuploader/carrierwave) from 3.0.7 to 3.1.3. - [Release notes](https://github.com/carrierwaveuploader/carrierwave/releases) - [Changelog](https://github.com/carrierwaveuploader/carrierwave/blob/master/CHANGELOG.md) - [Commits](https://github.com/carrierwaveuploader/carrierwave/compare/v3.0.7...v3.1.3) --- updated-dependencies: - dependency-name: carrierwave dependency-version: 3.1.3 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> * Bump rubocop from 1.88.0 to 1.88.1 (#4691) Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.88.0 to 1.88.1. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.88.0...v1.88.1) --- updated-dependencies: - dependency-name: rubocop dependency-version: 1.88.1 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump sitemap_generator from 7.0.2 to 7.0.3 (#4692) Bumps [sitemap_generator](https://github.com/kjvarga/sitemap_generator) from 7.0.2 to 7.0.3. - [Changelog](https://github.com/kjvarga/sitemap_generator/blob/master/CHANGES.md) - [Commits](https://github.com/kjvarga/sitemap_generator/compare/v7.0.2...v7.0.3) --- updated-dependencies: - dependency-name: sitemap_generator dependency-version: 7.0.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump sitemap_generator from 7.0.3 to 7.1.0 Bumps [sitemap_generator](https://github.com/kjvarga/sitemap_generator) from 7.0.3 to 7.1.0. - [Changelog](https://github.com/kjvarga/sitemap_generator/blob/master/CHANGES.md) - [Commits](https://github.com/kjvarga/sitemap_generator/compare/v7.0.3...v7.1.0) --- updated-dependencies: - dependency-name: sitemap_generator dependency-version: 7.1.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Bump haml_lint from 0.74.0 to 0.75.0 (#4694) Bumps [haml_lint](https://github.com/sds/haml-lint) from 0.74.0 to 0.75.0. - [Release notes](https://github.com/sds/haml-lint/releases) - [Changelog](https://github.com/sds/haml-lint/blob/main/CHANGELOG.md) - [Commits](https://github.com/sds/haml-lint/compare/v0.74.0...v0.75.0) --- updated-dependencies: - dependency-name: haml_lint dependency-version: 0.75.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump rubocop from 1.88.1 to 1.88.2 Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.88.1 to 1.88.2. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.88.1...v1.88.2) --- updated-dependencies: - dependency-name: rubocop dependency-version: 1.88.2 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Cesy <cesy.avon@gmail.com> Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This commit is contained in:
2
.github/workflows/ci-features-admin.yml
vendored
2
.github/workflows/ci-features-admin.yml
vendored
@@ -61,7 +61,7 @@ jobs:
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: Setup yarn cache
|
||||
uses: actions/cache@v5
|
||||
uses: actions/cache@v6
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
|
||||
2
.github/workflows/ci-features-comments.yml
vendored
2
.github/workflows/ci-features-comments.yml
vendored
@@ -61,7 +61,7 @@ jobs:
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: Setup yarn cache
|
||||
uses: actions/cache@v5
|
||||
uses: actions/cache@v6
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
|
||||
@@ -61,7 +61,7 @@ jobs:
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: Setup yarn cache
|
||||
uses: actions/cache@v5
|
||||
uses: actions/cache@v6
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
|
||||
2
.github/workflows/ci-features-crops.yml
vendored
2
.github/workflows/ci-features-crops.yml
vendored
@@ -61,7 +61,7 @@ jobs:
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: Setup yarn cache
|
||||
uses: actions/cache@v5
|
||||
uses: actions/cache@v6
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
|
||||
2
.github/workflows/ci-features-gardens.yml
vendored
2
.github/workflows/ci-features-gardens.yml
vendored
@@ -61,7 +61,7 @@ jobs:
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: Setup yarn cache
|
||||
uses: actions/cache@v5
|
||||
uses: actions/cache@v6
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
|
||||
2
.github/workflows/ci-features-harvests.yml
vendored
2
.github/workflows/ci-features-harvests.yml
vendored
@@ -61,7 +61,7 @@ jobs:
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: Setup yarn cache
|
||||
uses: actions/cache@v5
|
||||
uses: actions/cache@v6
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
|
||||
2
.github/workflows/ci-features-home.yml
vendored
2
.github/workflows/ci-features-home.yml
vendored
@@ -61,7 +61,7 @@ jobs:
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: Setup yarn cache
|
||||
uses: actions/cache@v5
|
||||
uses: actions/cache@v6
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
|
||||
2
.github/workflows/ci-features-members.yml
vendored
2
.github/workflows/ci-features-members.yml
vendored
@@ -61,7 +61,7 @@ jobs:
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: Setup yarn cache
|
||||
uses: actions/cache@v5
|
||||
uses: actions/cache@v6
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
|
||||
2
.github/workflows/ci-features-places.yml
vendored
2
.github/workflows/ci-features-places.yml
vendored
@@ -61,7 +61,7 @@ jobs:
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: Setup yarn cache
|
||||
uses: actions/cache@v5
|
||||
uses: actions/cache@v6
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
|
||||
2
.github/workflows/ci-features-plantings.yml
vendored
2
.github/workflows/ci-features-plantings.yml
vendored
@@ -61,7 +61,7 @@ jobs:
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: Setup yarn cache
|
||||
uses: actions/cache@v5
|
||||
uses: actions/cache@v6
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
|
||||
2
.github/workflows/ci-features-posts.yml
vendored
2
.github/workflows/ci-features-posts.yml
vendored
@@ -61,7 +61,7 @@ jobs:
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: Setup yarn cache
|
||||
uses: actions/cache@v5
|
||||
uses: actions/cache@v6
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
|
||||
2
.github/workflows/ci-features-seeds.yml
vendored
2
.github/workflows/ci-features-seeds.yml
vendored
@@ -61,7 +61,7 @@ jobs:
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: Setup yarn cache
|
||||
uses: actions/cache@v5
|
||||
uses: actions/cache@v6
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
|
||||
2
.github/workflows/ci-features-timeline.yml
vendored
2
.github/workflows/ci-features-timeline.yml
vendored
@@ -61,7 +61,7 @@ jobs:
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: Setup yarn cache
|
||||
uses: actions/cache@v5
|
||||
uses: actions/cache@v6
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
|
||||
2
.github/workflows/ci-features.yml
vendored
2
.github/workflows/ci-features.yml
vendored
@@ -61,7 +61,7 @@ jobs:
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: Setup yarn cache
|
||||
uses: actions/cache@v5
|
||||
uses: actions/cache@v6
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
|
||||
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -76,7 +76,7 @@ jobs:
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: Setup yarn cache
|
||||
uses: actions/cache@v5
|
||||
uses: actions/cache@v6
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
|
||||
62
Gemfile.lock
62
Gemfile.lock
@@ -138,22 +138,12 @@ GEM
|
||||
aws-sigv4 (~> 1.5)
|
||||
aws-sigv4 (1.12.1)
|
||||
aws-eventstream (~> 1, >= 1.0.2)
|
||||
axe-core-api (4.11.3)
|
||||
axe-core-api (4.12.0)
|
||||
dumb_delegator
|
||||
ostruct
|
||||
virtus
|
||||
axe-core-capybara (4.11.3)
|
||||
axe-core-api (= 4.11.3)
|
||||
dumb_delegator
|
||||
axe-core-rspec (4.11.3)
|
||||
axe-core-api (= 4.11.3)
|
||||
dumb_delegator
|
||||
ostruct
|
||||
virtus
|
||||
axiom-types (0.1.1)
|
||||
descendants_tracker (~> 0.0.4)
|
||||
ice_nine (~> 0.11.0)
|
||||
thread_safe (~> 0.3, >= 0.3.1)
|
||||
axe-core-capybara (4.12.0)
|
||||
axe-core-api (= 4.12.0)
|
||||
axe-core-rspec (4.12.0)
|
||||
axe-core-api (= 4.12.0)
|
||||
base64 (0.3.0)
|
||||
bcrypt (3.1.22)
|
||||
benchmark (0.5.0)
|
||||
@@ -196,7 +186,7 @@ GEM
|
||||
capybara-screenshot (1.0.27)
|
||||
capybara (>= 1.0, < 4)
|
||||
launchy
|
||||
carrierwave (3.0.7)
|
||||
carrierwave (3.1.3)
|
||||
activemodel (>= 6.0.0)
|
||||
activesupport (>= 6.0.0)
|
||||
addressable (~> 2.6)
|
||||
@@ -207,8 +197,6 @@ GEM
|
||||
childprocess (5.1.0)
|
||||
logger (~> 1.5)
|
||||
coderay (1.1.3)
|
||||
coercible (1.0.0)
|
||||
descendants_tracker (~> 0.0.1)
|
||||
coffee-rails (5.0.0)
|
||||
coffee-script (>= 2.2.0)
|
||||
railties (>= 5.2.0)
|
||||
@@ -242,8 +230,6 @@ GEM
|
||||
database_cleaner-core (~> 2.0.0)
|
||||
database_cleaner-core (2.0.1)
|
||||
date (3.5.1)
|
||||
descendants_tracker (0.0.4)
|
||||
thread_safe (~> 0.3, >= 0.3.1)
|
||||
devise (5.0.4)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
@@ -289,8 +275,8 @@ GEM
|
||||
logger
|
||||
faraday-net_http (3.4.4)
|
||||
net-http (~> 0.5)
|
||||
ffi (1.17.3)
|
||||
ffi (1.17.3-x86_64-linux-gnu)
|
||||
ffi (1.17.4)
|
||||
ffi (1.17.4-x86_64-linux-gnu)
|
||||
flickraw (0.9.10)
|
||||
font-awesome-sass (5.15.1)
|
||||
sassc (>= 1.11)
|
||||
@@ -319,7 +305,7 @@ GEM
|
||||
activesupport (>= 5.1)
|
||||
haml (>= 4.0.6)
|
||||
railties (>= 5.1)
|
||||
haml_lint (0.74.0)
|
||||
haml_lint (0.75.0)
|
||||
haml (>= 5.0)
|
||||
parallel (>= 1.10)
|
||||
rainbow
|
||||
@@ -358,9 +344,8 @@ GEM
|
||||
logger
|
||||
ostruct
|
||||
ice_cube (0.17.0)
|
||||
ice_nine (0.11.2)
|
||||
image_processing (1.12.2)
|
||||
mini_magick (>= 4.9.5, < 5)
|
||||
image_processing (1.14.0)
|
||||
mini_magick (>= 4.9.5, < 6)
|
||||
ruby-vips (>= 2.0.17, < 3)
|
||||
io-console (0.8.2)
|
||||
irb (1.18.0)
|
||||
@@ -373,7 +358,7 @@ GEM
|
||||
rails-dom-testing (>= 1, < 3)
|
||||
railties (>= 4.2.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
json (2.19.9)
|
||||
json (2.20.0)
|
||||
json-schema (6.2.0)
|
||||
addressable (~> 2.8)
|
||||
bigdecimal (>= 3.1, < 5)
|
||||
@@ -385,7 +370,7 @@ GEM
|
||||
kgio (2.11.4)
|
||||
kramdown (2.4.0)
|
||||
rexml
|
||||
language_server-protocol (3.17.0.5)
|
||||
language_server-protocol (3.17.0.6)
|
||||
launchy (3.1.1)
|
||||
addressable (~> 2.8)
|
||||
childprocess (~> 5.0)
|
||||
@@ -429,7 +414,8 @@ GEM
|
||||
mimemagic (0.4.3)
|
||||
nokogiri (~> 1)
|
||||
rake
|
||||
mini_magick (4.12.0)
|
||||
mini_magick (5.3.1)
|
||||
logger
|
||||
mini_mime (1.1.5)
|
||||
mini_portile2 (2.8.9)
|
||||
minitest (6.0.6)
|
||||
@@ -628,7 +614,7 @@ GEM
|
||||
rswag-ui (2.17.0)
|
||||
actionpack (>= 5.2, < 8.2)
|
||||
railties (>= 5.2, < 8.2)
|
||||
rubocop (1.88.0)
|
||||
rubocop (1.88.2)
|
||||
json (~> 2.3)
|
||||
language_server-protocol (~> 3.17.0.2)
|
||||
lint_roller (~> 1.1.0)
|
||||
@@ -639,7 +625,7 @@ GEM
|
||||
rubocop-ast (>= 1.49.0, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 2.4.0, < 4.0)
|
||||
rubocop-ast (1.49.1)
|
||||
rubocop-ast (1.50.0)
|
||||
parser (>= 3.3.7.2)
|
||||
prism (~> 1.7)
|
||||
rubocop-capybara (3.0.0)
|
||||
@@ -667,8 +653,9 @@ GEM
|
||||
rubocop-rspec (~> 3.5)
|
||||
ruby-progressbar (1.13.0)
|
||||
ruby-units (4.1.0)
|
||||
ruby-vips (2.2.1)
|
||||
ruby-vips (2.3.0)
|
||||
ffi (~> 1.12)
|
||||
logger
|
||||
rubyzip (3.4.0)
|
||||
sass (3.7.4)
|
||||
sass-listen (~> 4.0.0)
|
||||
@@ -702,7 +689,7 @@ GEM
|
||||
rack (>= 2.2.4, < 3.3)
|
||||
redis-client (>= 0.23.0, < 1)
|
||||
simple_po_parser (1.1.6)
|
||||
sitemap_generator (6.3.0)
|
||||
sitemap_generator (7.1.0)
|
||||
builder (~> 3.0)
|
||||
sprockets (3.7.5)
|
||||
base64
|
||||
@@ -712,7 +699,7 @@ GEM
|
||||
actionpack (>= 5.2)
|
||||
activesupport (>= 5.2)
|
||||
sprockets (>= 3.0.0)
|
||||
ssrf_filter (1.1.2)
|
||||
ssrf_filter (1.5.0)
|
||||
stringio (3.2.0)
|
||||
sysexits (1.2.0)
|
||||
temple (0.10.4)
|
||||
@@ -721,8 +708,7 @@ GEM
|
||||
terser (1.2.7)
|
||||
execjs (>= 0.3.0, < 3)
|
||||
thor (1.5.0)
|
||||
thread_safe (0.3.6)
|
||||
tilt (2.7.0)
|
||||
tilt (2.8.0)
|
||||
timecop (0.9.11)
|
||||
timeout (0.6.1)
|
||||
tsort (0.2.0)
|
||||
@@ -741,10 +727,6 @@ GEM
|
||||
activemodel (>= 3.0.0)
|
||||
public_suffix
|
||||
vcr (6.4.0)
|
||||
virtus (2.0.0)
|
||||
axiom-types (~> 0.1)
|
||||
coercible (~> 1.0)
|
||||
descendants_tracker (~> 0.0, >= 0.0.3)
|
||||
warden (1.2.9)
|
||||
rack (>= 2.0.9)
|
||||
webrat (0.7.3)
|
||||
|
||||
@@ -4,27 +4,26 @@ class HarvestsController < DataController
|
||||
after_action :update_crop_medians, only: %i(create update destroy)
|
||||
|
||||
def index
|
||||
where = {}
|
||||
@harvests = Harvest.all
|
||||
|
||||
if params[:member_slug].present?
|
||||
@owner = Member.find_by!(slug: params[:member_slug])
|
||||
where['owner_id'] = @owner.id
|
||||
@harvests = @harvests.where(owner_id: @owner.id)
|
||||
end
|
||||
|
||||
if params[:crop_slug]
|
||||
@crop = Crop.find_by(slug: params[:crop_slug])
|
||||
where['crop_id'] = @crop.id
|
||||
@harvests = @harvests.where(crop_id: @crop.id) if @crop
|
||||
end
|
||||
|
||||
if params[:planting_slug]
|
||||
@planting = Planting.find_by(slug: params[:planting_slug])
|
||||
where['planting_id'] = @planting.id
|
||||
@harvests = @harvests.where(planting_id: @planting.id) if @planting
|
||||
end
|
||||
|
||||
@harvests = Harvest.search('*', where:,
|
||||
limit: 100,
|
||||
page: params[:page],
|
||||
load: (request.format.csv? ? { include: %i(crop owner plant_part) } : false),
|
||||
boost_by: [:created_at])
|
||||
@harvests = @harvests.includes(:crop, :owner, :plant_part)
|
||||
|
||||
@harvests = @harvests.recent.paginate(page: params[:page], per_page: 100)
|
||||
|
||||
@filename = csv_filename
|
||||
|
||||
|
||||
@@ -40,12 +40,9 @@ class MembersController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
@harvests = Harvest.search(
|
||||
where: { owner_id: @member.id },
|
||||
boost_by: [:created_at],
|
||||
limit: 16,
|
||||
load: false
|
||||
)
|
||||
@harvests = Harvest.where(owner_id: @member.id)
|
||||
.recent
|
||||
.limit(16)
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.haml
|
||||
|
||||
@@ -8,26 +8,10 @@ class PlantingsController < DataController
|
||||
def index
|
||||
@show_all = params[:all] == '1'
|
||||
|
||||
where = {}
|
||||
where['active'] = true unless @show_all
|
||||
@owner = Member.find_by!(slug: params[:member_slug]) if params[:member_slug].present?
|
||||
@crop = Crop.find_by(slug: params[:crop_slug]) if params[:crop_slug]
|
||||
|
||||
if params[:member_slug].present?
|
||||
@owner = Member.find_by!(slug: params[:member_slug])
|
||||
where['owner_id'] = @owner.id
|
||||
end
|
||||
|
||||
if params[:crop_slug]
|
||||
@crop = Crop.find_by(slug: params[:crop_slug])
|
||||
where['crop_id'] = @crop.id unless @crop.nil?
|
||||
end
|
||||
|
||||
@plantings = Planting.search(
|
||||
where:,
|
||||
page: params[:page],
|
||||
limit: 30,
|
||||
boost_by: [:created_at],
|
||||
load: false
|
||||
)
|
||||
@plantings = plantings
|
||||
|
||||
@filename = "Growstuff-#{specifics}Plantings-#{Time.zone.now.to_fs(:number)}.csv"
|
||||
respond_with(@plantings)
|
||||
@@ -35,7 +19,7 @@ class PlantingsController < DataController
|
||||
|
||||
def show
|
||||
@photos = @planting.photos.includes(:owner).order(date_taken: :desc)
|
||||
@harvests = Harvest.search(where: { planting_id: @planting.id })
|
||||
@harvests = Harvest.where(planting_id: @planting.id).recent
|
||||
@current_activities = @planting.activities.current.includes(:owner).order(created_at: :desc)
|
||||
@finished_activities = @planting.activities.finished.includes(:owner).order(created_at: :desc)
|
||||
@matching_seeds = matching_seeds
|
||||
|
||||
@@ -2,36 +2,32 @@
|
||||
|
||||
class SeedsController < DataController
|
||||
def index
|
||||
where = {}
|
||||
@seeds = Seed.all
|
||||
|
||||
if params[:member_slug].present?
|
||||
@owner = Member.find_by!(slug: params[:member_slug])
|
||||
where['owner_id'] = @owner.id
|
||||
@seeds = @seeds.where(owner_id: @owner.id)
|
||||
end
|
||||
|
||||
if params[:crop_slug].present?
|
||||
@crop = Crop.find_by(slug: params[:crop_slug])
|
||||
where['crop_id'] = @crop.id
|
||||
@seeds = @seeds.where(crop_id: @crop.id) if @crop
|
||||
end
|
||||
|
||||
if params[:planting_id].present?
|
||||
@planting = Planting.find_by(slug: params[:planting_id])
|
||||
where['parent_planting'] = @planting.id
|
||||
@seeds = @seeds.where(parent_planting_id: @planting.id) if @planting
|
||||
end
|
||||
|
||||
where['tradeable_to'] = params[:tradeable_to] if params[:tradeable_to].present?
|
||||
@seeds = @seeds.where(tradable_to: params[:tradeable_to]) if params[:tradeable_to].present?
|
||||
|
||||
@show_all = (params[:all] == '1')
|
||||
where['finished'] = false unless @show_all
|
||||
@seeds = @seeds.current unless @show_all
|
||||
|
||||
@filename = csv_filename
|
||||
@seeds = Seed.search(
|
||||
where:,
|
||||
page: params[:page],
|
||||
limit: 30,
|
||||
boost_by: [:created_at],
|
||||
load: (request.format.csv? ? { include: %i(crop owner) } : false)
|
||||
)
|
||||
@seeds = @seeds.includes(:crop, :owner)
|
||||
.order(created_at: :desc)
|
||||
.paginate(page: params[:page], per_page: 30)
|
||||
|
||||
respond_with(@seeds)
|
||||
end
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module SearchHarvests
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
searchkick merge_mappings: true,
|
||||
settings: { number_of_shards: 1, number_of_replicas: 0 },
|
||||
mappings: {
|
||||
properties: {
|
||||
harvests_count: { type: :integer },
|
||||
photos_count: { type: :integer },
|
||||
created_at: { type: :integer },
|
||||
harvested_at: { type: :date }
|
||||
}
|
||||
}
|
||||
|
||||
def search_data
|
||||
{
|
||||
slug:,
|
||||
quantity:,
|
||||
|
||||
# crop
|
||||
crop_id:,
|
||||
crop_name:,
|
||||
crop_slug: crop.slug,
|
||||
|
||||
# owner
|
||||
owner_id:,
|
||||
owner_login_name:,
|
||||
owner_slug:,
|
||||
plant_part_name: plant_part&.name,
|
||||
|
||||
# planting
|
||||
planting_id:,
|
||||
planting_slug: planting&.slug,
|
||||
|
||||
# photo
|
||||
has_photos: photos.size.positive?,
|
||||
thumbnail_url: default_photo&.thumbnail_url || crop.default_photo&.thumbnail_url,
|
||||
|
||||
# counts
|
||||
photos_count: photos.count,
|
||||
|
||||
# timestamps
|
||||
harvested_at:,
|
||||
created_at: created_at.to_i
|
||||
}
|
||||
end
|
||||
|
||||
def self.homepage_records(limit)
|
||||
records = []
|
||||
owners = []
|
||||
1..limit.times do
|
||||
where = {
|
||||
# Disabled for now so that more relevant harvests are
|
||||
# surfaced; even if we're falling back to crop photos.
|
||||
# photos_count: { gt: 0 },
|
||||
owner_id: { not: owners }
|
||||
}
|
||||
one_record = search('*',
|
||||
limit: 1,
|
||||
where:,
|
||||
boost_by: [:created_at],
|
||||
load: false).first
|
||||
return records if one_record.nil?
|
||||
|
||||
owners << one_record.owner_id
|
||||
records << one_record
|
||||
end
|
||||
records
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,87 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module SearchPlantings
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
searchkick merge_mappings: true,
|
||||
settings: { number_of_shards: 1, number_of_replicas: 0 },
|
||||
mappings: {
|
||||
properties: {
|
||||
active: { type: :boolean },
|
||||
created_at: { type: :integer },
|
||||
harvests_count: { type: :integer },
|
||||
photos_count: { type: :integer },
|
||||
owner_location: { type: :text }
|
||||
}
|
||||
}
|
||||
|
||||
def search_data
|
||||
{
|
||||
slug:,
|
||||
active:,
|
||||
finished: finished?,
|
||||
has_photos: photos.size.positive?,
|
||||
location:,
|
||||
percentage_grown: percentage_grown.to_i,
|
||||
planted_at:,
|
||||
planted_from:,
|
||||
planted_year: planted_at&.year,
|
||||
quantity:,
|
||||
sunniness:,
|
||||
garden_id:,
|
||||
garden_slug: garden&.garden_slug,
|
||||
garden_name: garden&.name,
|
||||
description:,
|
||||
|
||||
first_harvest_predicted_at:,
|
||||
finish_predicted_at:,
|
||||
|
||||
# crops
|
||||
crop_id:,
|
||||
crop_name:,
|
||||
crop_slug:,
|
||||
crop_perennial:,
|
||||
|
||||
# owner
|
||||
owner_id:,
|
||||
owner_location:,
|
||||
owner_login_name:,
|
||||
owner_slug:,
|
||||
|
||||
# photos
|
||||
thumbnail_url: default_photo&.thumbnail_url || crop.default_photo&.thumbnail_url,
|
||||
# counts
|
||||
photos_count: photos.size,
|
||||
harvests_count:,
|
||||
|
||||
# timestamps
|
||||
created_at: created_at.to_i,
|
||||
updated_at: updated_at.to_i
|
||||
}
|
||||
end
|
||||
|
||||
def self.homepage_records(limit)
|
||||
records = []
|
||||
owners = []
|
||||
1..limit.times do
|
||||
where = {
|
||||
# Disabled for now so that more relevant plantings are
|
||||
# surfaced; even if we're falling back to crop photos.
|
||||
# photos_count: { gt: 0 },
|
||||
owner_id: { not: owners }
|
||||
}
|
||||
one_record = search('*',
|
||||
limit: 1,
|
||||
where:,
|
||||
boost_by: [:created_at],
|
||||
load: false).first
|
||||
return records if one_record.nil?
|
||||
|
||||
owners << one_record.owner_id
|
||||
records << one_record
|
||||
end
|
||||
records
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,69 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module SearchSeeds
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
searchkick merge_mappings: true,
|
||||
settings: { number_of_shards: 1, number_of_replicas: 0 },
|
||||
mappings: {
|
||||
properties: {
|
||||
id: { type: :integer },
|
||||
created_at: { type: :integer },
|
||||
plant_before: { type: :text },
|
||||
photos_count: { type: :integer },
|
||||
tradable_to: { type: :text }
|
||||
}
|
||||
}
|
||||
|
||||
def search_data
|
||||
{
|
||||
slug:,
|
||||
finished: finished?,
|
||||
gmo:,
|
||||
active:,
|
||||
heirloom:,
|
||||
location: owner.location,
|
||||
organic:,
|
||||
quantity:,
|
||||
plant_before: plant_before&.to_fs(:ymd),
|
||||
tradable_to:,
|
||||
tradable:,
|
||||
|
||||
# crop
|
||||
crop_id:,
|
||||
crop_name: crop.name,
|
||||
crop_slug: crop.slug,
|
||||
|
||||
# owner
|
||||
owner_id:,
|
||||
owner_location:,
|
||||
owner_login_name:,
|
||||
owner_slug:,
|
||||
|
||||
# planting
|
||||
parent_planting:,
|
||||
|
||||
# counts
|
||||
photos_count: photos.size,
|
||||
|
||||
# photo
|
||||
has_photos: photos.size.positive?,
|
||||
thumbnail_url: default_photo&.thumbnail_url || crop.default_photo&.thumbnail_url,
|
||||
|
||||
created_at: created_at.to_i
|
||||
}
|
||||
end
|
||||
|
||||
def self.homepage_records(limit)
|
||||
search('*', limit:,
|
||||
where: {
|
||||
finished: false,
|
||||
tradable: true,
|
||||
_or: [{ plant_before: nil }, { plant_before: { lt: Date.today } }]
|
||||
},
|
||||
boost_by: [:created_at],
|
||||
load: false)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -5,7 +5,6 @@ class Harvest < ApplicationRecord
|
||||
extend FriendlyId
|
||||
include PhotoCapable
|
||||
include Ownable
|
||||
include SearchHarvests
|
||||
include Likeable
|
||||
|
||||
attr_accessor :overall_rating
|
||||
@@ -156,6 +155,10 @@ class Harvest < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def self.homepage_records(limit)
|
||||
recent.one_per_owner.limit(limit)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def crop_must_match_planting
|
||||
|
||||
@@ -7,7 +7,6 @@ class Planting < ApplicationRecord
|
||||
include Ownable
|
||||
include PredictPlanting
|
||||
include PredictHarvest
|
||||
include SearchPlantings
|
||||
include Likeable
|
||||
|
||||
friendly_id :planting_slug, use: %i(slugged finders)
|
||||
@@ -133,6 +132,10 @@ class Planting < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def self.homepage_records(limit)
|
||||
recent.one_per_owner.limit(limit)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def cannot_be_finished_and_failed
|
||||
|
||||
@@ -5,7 +5,6 @@ class Seed < ApplicationRecord
|
||||
include PhotoCapable
|
||||
include Finishable
|
||||
include Ownable
|
||||
include SearchSeeds
|
||||
|
||||
friendly_id :seed_slug, use: %i(slugged finders)
|
||||
|
||||
@@ -73,4 +72,11 @@ class Seed < ApplicationRecord
|
||||
def to_s
|
||||
I18n.t('seeds.string', crop: crop.name, owner:)
|
||||
end
|
||||
|
||||
def self.homepage_records(limit)
|
||||
current.tradable
|
||||
.where("plant_before IS NULL OR plant_before < ?", Time.zone.today)
|
||||
.order(created_at: :desc)
|
||||
.limit(limit)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
%h2= t('.recently_planted')
|
||||
- Planting.homepage_records(6).each do |planting|
|
||||
- next unless planting['thumbnail_url'].present?
|
||||
= link_to planting_path(slug: planting['slug']), class: 'list-group-item list-group-item-action flex-column align-items-start' do
|
||||
- next unless planting.thumbnail_url.present?
|
||||
= link_to planting_path(slug: planting.slug), class: 'list-group-item list-group-item-action flex-column align-items-start' do
|
||||
.d-flex.w-100.justify-content-between.homepage--list-item
|
||||
%p.mb-2
|
||||
= image_tag planting['thumbnail_url'], width: 75, class: 'rounded shadow', alt: "Image of #{planting['crop_name']} by #{planting['owner_login_name']}"
|
||||
= image_tag planting.thumbnail_url, width: 75, class: 'rounded shadow', alt: "Image of #{planting.crop_name} by #{planting.owner_login_name}"
|
||||
.text-right
|
||||
%h4= planting['crop_name']
|
||||
- if planting['planted_from'].present?
|
||||
%span.badge.badge-success= planting['planted_from'].pluralize
|
||||
%small.text-muted planted by #{planting['owner_login_name']}
|
||||
%h4= planting.crop_name
|
||||
- if planting.planted_from.present?
|
||||
%span.badge.badge-success= planting.planted_from.pluralize
|
||||
%small.text-muted planted by #{planting.owner_login_name}
|
||||
|
||||
@@ -7,34 +7,34 @@ cal.description = "Plantings by #{@owner.login_name}"
|
||||
event = Icalendar::Event.new
|
||||
|
||||
lines = []
|
||||
lines << "Quantity: #{planting['quantity'] ? planting['quantity'] : 'unknown' }"
|
||||
lines << "Planted on: #{planting['planted_at'] ? planting['planted_at'] : 'unknown' }"
|
||||
lines << "Sunniness: #{planting['sunniness'] ? planting['sunniness'] : 'unknown' }"
|
||||
lines << "Planted from: #{planting['planted_from'] ? planting['planted_from'] : 'unknown' }"
|
||||
lines << "First harvest from: #{planting['first_harvest_predicted_at'] ? planting['first_harvest_predicted_at'] : 'unknown' }"
|
||||
lines << "Last harvest from: #{planting['last_harvest_predicted_at'] ? planting['last_harvest_predicted_at'] : 'unknown' }"
|
||||
lines << "Finish predicted at: #{planting['finish_predicted_at'] ? planting['finish_predicted_at'] : 'unknown'}"
|
||||
lines << "Finished at: #{planting['finished_at'] ? planting['finished_at'] : 'unknown' }"
|
||||
lines << "Quantity: #{planting.quantity || 'unknown' }"
|
||||
lines << "Planted on: #{planting.planted_at || 'unknown' }"
|
||||
lines << "Sunniness: #{planting.sunniness || 'unknown' }"
|
||||
lines << "Planted from: #{planting.planted_from || 'unknown' }"
|
||||
lines << "First harvest from: #{planting.first_harvest_predicted_at || 'unknown' }"
|
||||
lines << "Last harvest from: #{planting.last_harvest_predicted_at || 'unknown' }"
|
||||
lines << "Finish predicted at: #{planting.finish_predicted_at || 'unknown'}"
|
||||
lines << "Finished at: #{planting.finished_at || 'unknown' }"
|
||||
|
||||
lines << planting.description
|
||||
finish_date = Date.parse(planting['finished_at'] || planting['finish_predicted_at'] || planting['last_harvest_predicted_at']) rescue nil
|
||||
finish_date = (planting.finished_at || planting.finish_predicted_at || planting.last_harvest_predicted_at)&.to_date
|
||||
|
||||
event.dtstart = Time.at(planting['created_at'])
|
||||
event.dtend = finish_date || 1.day.from_now
|
||||
event.summary = planting['crop_name']
|
||||
event.dtstart = planting.created_at
|
||||
event.dtend = finish_date || 1.day.from_now.to_date
|
||||
event.summary = planting.crop.name
|
||||
event.description = lines.join("\n")
|
||||
event.ip_class = "PUBLIC"
|
||||
event.url = planting_url(slug: planting['slug'])
|
||||
event.url = planting_url(slug: planting.slug)
|
||||
|
||||
cal.add_event(event)
|
||||
|
||||
if finish_date && finish_date > Date.today
|
||||
predicted_date = Date.parse(planting['first_harvest_predicted_at']) if planting['first_harvest_predicted_at']
|
||||
predicted_date = planting.first_harvest_predicted_at&.to_date
|
||||
|
||||
todo = Icalendar::Todo.new
|
||||
todo.dtstart = predicted_date || finish_date || Date.today
|
||||
todo.due = finish_date
|
||||
todo.summary = "Harvest #{planting['crop_name']}"
|
||||
todo.summary = "Harvest #{planting.crop.name}"
|
||||
|
||||
cal.add_todo(todo)
|
||||
|
||||
@@ -42,9 +42,9 @@ cal.description = "Plantings by #{@owner.login_name}"
|
||||
event = Icalendar::Event.new
|
||||
event.dtstart = predicted_date || finish_date || Date.today
|
||||
event.dtend = finish_date
|
||||
event.summary = "Harvest #{planting['crop_name']}"
|
||||
event.summary = "Harvest #{planting.crop.name}"
|
||||
event.ip_class = "PUBLIC"
|
||||
event.url = planting_url(slug: planting['slug'])
|
||||
event.url = planting_url(slug: planting.slug)
|
||||
|
||||
cal.add_event(event)
|
||||
end
|
||||
|
||||
@@ -6,15 +6,15 @@
|
||||
%link= plantings_url
|
||||
- @plantings.each do |planting|
|
||||
%item
|
||||
%title #{planting['crop_name']} in #{planting['location']}
|
||||
%pubdate= planting['created_at'].to_fs(:rfc822)
|
||||
%title #{planting.crop_name} in #{planting.location}
|
||||
%pubdate= planting.created_at.to_fs(:rfc822)
|
||||
%description
|
||||
:escaped
|
||||
<p>Quantity: #{planting['quantity'] ? planting['quantity'] : 'unknown' }</p>
|
||||
<p>Planted on: #{planting['planted_at'] ? planting['planted_at'] : 'unknown' }</p>
|
||||
<p>Sunniness: #{planting['sunniness'] ? planting['sunniness'] : 'unknown' }</p>
|
||||
<p>Planted from: #{planting['planted_from'] ? planting['planted_from'] : 'unknown' }</p>
|
||||
<p>Quantity: #{planting.quantity ? planting.quantity : 'unknown' }</p>
|
||||
<p>Planted on: #{planting.planted_at ? planting.planted_at : 'unknown' }</p>
|
||||
<p>Sunniness: #{planting.sunniness ? planting.sunniness : 'unknown' }</p>
|
||||
<p>Planted from: #{planting.planted_from ? planting.planted_from : 'unknown' }</p>
|
||||
:escaped_markdown
|
||||
#{ strip_tags markdownify(planting['description']) }
|
||||
%link= planting_url(slug: planting['slug'])
|
||||
%guid= planting_url(slug: planting['slug'])
|
||||
#{ strip_tags markdownify(planting.description) }
|
||||
%link= planting_url(slug: planting.slug)
|
||||
%guid= planting_url(slug: planting.slug)
|
||||
|
||||
@@ -17,6 +17,6 @@
|
||||
<p>Heirloom? #{seed.heirloom}</p>
|
||||
- if seed.tradable
|
||||
:escaped
|
||||
<p>Will trade #{seed.tradable_to} from #{seed.location ||= 'unknown location'}</p>
|
||||
<p>Will trade #{seed.tradable_to} from #{seed.location || 'unknown location'}</p>
|
||||
%link= seed_url(slug: seed.slug)
|
||||
%guid= seed_url(slug: seed.slug)
|
||||
|
||||
@@ -27,6 +27,11 @@ class Rack::Attack
|
||||
end
|
||||
end
|
||||
|
||||
# Abusive services
|
||||
blocklist('block Semrush crawler') do |request|
|
||||
request.user_agent.to_s.downcase.include?('semrush')
|
||||
end
|
||||
|
||||
### Custom Response Headers ###
|
||||
|
||||
# Add Retry-After header to throttled responses
|
||||
|
||||
@@ -4,12 +4,6 @@ class ElasticIndexing < ActiveRecord::Migration[5.2]
|
||||
def up
|
||||
say 'indexing crops'
|
||||
Crop.reindex
|
||||
say 'indexing plantings'
|
||||
Planting.reindex
|
||||
say 'indexing seeds'
|
||||
Seed.reindex
|
||||
say 'indexing harvests'
|
||||
Harvest.reindex
|
||||
say 'indexing photos'
|
||||
Photo.reindex
|
||||
end
|
||||
|
||||
@@ -4,8 +4,5 @@ namespace :search do
|
||||
desc 'reindex'
|
||||
task reindex: :environment do
|
||||
Crop.reindex
|
||||
Planting.reindex
|
||||
Harvest.reindex
|
||||
Seed.reindex
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe HarvestsController, :search do
|
||||
describe HarvestsController do
|
||||
login_member
|
||||
|
||||
def valid_attributes
|
||||
@@ -22,14 +22,12 @@ describe HarvestsController, :search do
|
||||
let!(:tomato_harvest) { create(:harvest, owner_id: first_member.id, crop_id: tomato.id) }
|
||||
let!(:maize_harvest) { create(:harvest, owner_id: second_member.id, crop_id: maize.id) }
|
||||
|
||||
before { Harvest.reindex }
|
||||
|
||||
describe "assigns all harvests as @harvests" do
|
||||
before { get :index, params: {} }
|
||||
|
||||
it { expect(assigns(:harvests).size).to eq 2 }
|
||||
it { expect(assigns(:harvests)[0].slug).to eq tomato_harvest.slug }
|
||||
it { expect(assigns(:harvests)[1].slug).to eq maize_harvest.slug }
|
||||
it { expect(assigns(:harvests)).to include(tomato_harvest) }
|
||||
it { expect(assigns(:harvests)).to include(maize_harvest) }
|
||||
end
|
||||
|
||||
describe "picks up owner from params and shows owner's harvests only" do
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe PlantingsController, :search do
|
||||
describe PlantingsController do
|
||||
login_member
|
||||
|
||||
def valid_attributes
|
||||
@@ -12,7 +12,7 @@ describe PlantingsController, :search do
|
||||
}
|
||||
end
|
||||
|
||||
describe "GET index", :search do
|
||||
describe "GET index" do
|
||||
let!(:first_member) { create(:member) }
|
||||
let!(:second_member) { create(:member) }
|
||||
let!(:tomato) { create(:tomato) }
|
||||
@@ -20,16 +20,12 @@ describe PlantingsController, :search do
|
||||
let!(:tomato_planting) { create(:planting, crop: tomato, owner: first_member, created_at: 1.day.ago) }
|
||||
let!(:maize_planting) { create(:planting, crop: maize, owner: second_member, created_at: 5.days.ago) }
|
||||
|
||||
before do
|
||||
Planting.reindex
|
||||
end
|
||||
|
||||
describe "assigns all plantings as @plantings" do
|
||||
before { get :index }
|
||||
|
||||
it { expect(assigns(:plantings).size).to eq 2 }
|
||||
it { expect(assigns(:plantings)[0]['slug']).to eq tomato_planting.slug }
|
||||
it { expect(assigns(:plantings)[1]['slug']).to eq maize_planting.slug }
|
||||
it { expect(assigns(:plantings)[0].slug).to eq tomato_planting.slug }
|
||||
it { expect(assigns(:plantings)[1].slug).to eq maize_planting.slug }
|
||||
end
|
||||
|
||||
describe "picks up owner from params and shows owner's plantings only" do
|
||||
@@ -37,14 +33,14 @@ describe PlantingsController, :search do
|
||||
|
||||
it { expect(assigns(:owner)).to eq first_member }
|
||||
it { expect(assigns(:plantings).size).to eq 1 }
|
||||
it { expect(assigns(:plantings).first['slug']).to eq tomato_planting.slug }
|
||||
it { expect(assigns(:plantings).first.slug).to eq tomato_planting.slug }
|
||||
end
|
||||
|
||||
describe "picks up crop from params and shows the plantings for the crop only" do
|
||||
before { get :index, params: { crop_slug: maize.slug } }
|
||||
|
||||
it { expect(assigns(:crop)).to eq maize }
|
||||
it { expect(assigns(:plantings).first['slug']).to eq maize_planting.slug }
|
||||
it { expect(assigns(:plantings).first.slug).to eq maize_planting.slug }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe SeedsController, :search do
|
||||
describe SeedsController do
|
||||
let(:owner) { create(:member) }
|
||||
|
||||
describe "GET index" do
|
||||
describe "picks up owner from params" do
|
||||
before do
|
||||
Seed.reindex
|
||||
get :index, params: { member_slug: owner.slug }
|
||||
end
|
||||
|
||||
@@ -25,7 +24,6 @@ describe SeedsController, :search do
|
||||
let!(:planting) { create(:planting, owner:) }
|
||||
|
||||
before do
|
||||
Seed.reindex
|
||||
get :new, params: { planting_slug: planting.to_param }
|
||||
end
|
||||
|
||||
|
||||
@@ -29,8 +29,5 @@ FactoryBot.define do
|
||||
end
|
||||
|
||||
trait :reindex do
|
||||
after(:create) do |harvest, _evaluator|
|
||||
harvest.reindex(refresh: true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -68,11 +68,5 @@ FactoryBot.define do
|
||||
planting.save
|
||||
end
|
||||
end
|
||||
|
||||
trait :reindex do
|
||||
after(:create) do |planting, _evaluator|
|
||||
planting.reindex(refresh: true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -31,11 +31,5 @@ FactoryBot.define do
|
||||
factory :untradable_seed do
|
||||
tradable_to { "nowhere" }
|
||||
end
|
||||
|
||||
trait :reindex do
|
||||
after(:create) do |seed, _evaluator|
|
||||
seed.reindex(refresh: true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe "browse harvests", :search do
|
||||
describe "browse harvests" do
|
||||
subject { page }
|
||||
|
||||
let!(:harvest) { create(:harvest, owner: member) }
|
||||
@@ -11,10 +11,9 @@ describe "browse harvests", :search do
|
||||
include_context 'signed in member'
|
||||
|
||||
describe 'blank optional fields' do
|
||||
let!(:harvest) { create(:harvest, :no_description, :reindex) }
|
||||
let!(:harvest) { create(:harvest, :no_description) }
|
||||
|
||||
before do
|
||||
Harvest.reindex
|
||||
visit harvests_path
|
||||
end
|
||||
|
||||
@@ -24,10 +23,9 @@ describe "browse harvests", :search do
|
||||
end
|
||||
|
||||
describe "filled in optional fields" do
|
||||
let!(:harvest) { create(:harvest, :long_description, :reindex) }
|
||||
let!(:harvest) { create(:harvest, :long_description) }
|
||||
|
||||
before do
|
||||
Harvest.reindex
|
||||
visit harvests_path
|
||||
end
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe "home page", :search do
|
||||
describe "home page" do
|
||||
subject { page }
|
||||
|
||||
let(:member) { create(:member) }
|
||||
@@ -14,9 +14,9 @@ describe "home page", :search do
|
||||
let(:seed) { create(:tradable_seed, owner: member, crop:) }
|
||||
let(:harvest) { create(:harvest, owner: member, crop:) }
|
||||
|
||||
let!(:tradable_seed) { create(:tradable_seed, :reindex, finished: false) }
|
||||
let!(:finished_seed) { create(:tradable_seed, :reindex, finished: true) }
|
||||
let!(:untradable_seed) { create(:untradable_seed, :reindex) }
|
||||
let!(:tradable_seed) { create(:tradable_seed, finished: false) }
|
||||
let!(:finished_seed) { create(:tradable_seed, finished: true) }
|
||||
let!(:untradable_seed) { create(:untradable_seed) }
|
||||
|
||||
before do
|
||||
# Add photos, so they can appear on home page
|
||||
@@ -25,9 +25,6 @@ describe "home page", :search do
|
||||
harvest.photos << photo
|
||||
|
||||
Crop.reindex
|
||||
Planting.reindex
|
||||
Seed.reindex
|
||||
Harvest.reindex
|
||||
|
||||
visit root_path
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ describe 'Likeable', :js, :search do
|
||||
let!(:activity) { create(:activity, :reindex, owner: member) }
|
||||
let!(:photo) { create(:photo, owner: member) }
|
||||
let!(:harvest) { create(:harvest, :reindex, owner: member) }
|
||||
let!(:planting) { create(:planting, :reindex, owner: member) }
|
||||
let!(:planting) { create(:planting, owner: member) }
|
||||
|
||||
include_context 'signed in member'
|
||||
|
||||
|
||||
@@ -10,8 +10,6 @@ describe "Planting a crop", :js, :search do
|
||||
create(:planting, garden:, owner: member, planted_at: Date.parse("2013-03-10"))
|
||||
end
|
||||
|
||||
before { Planting.reindex }
|
||||
|
||||
context 'signed in' do
|
||||
include_context 'signed in member'
|
||||
before { visit new_planting_path }
|
||||
@@ -223,9 +221,6 @@ describe "Planting a crop", :js, :search do
|
||||
expect(page).to have_content "Aug 2014"
|
||||
expect(page).to have_content "4/5"
|
||||
|
||||
# ensure we've indexed in elastic search
|
||||
planting.reindex(refresh: true)
|
||||
|
||||
# shouldn't be on the page
|
||||
visit plantings_path
|
||||
expect(page).to have_no_content "maize"
|
||||
|
||||
@@ -9,7 +9,6 @@ describe 'Plantings RSS feed' do
|
||||
end
|
||||
|
||||
it 'The index title is what we expect' do
|
||||
Planting.reindex
|
||||
visit plantings_path(format: 'rss')
|
||||
expect(page).to have_content "Recent plantings from " \
|
||||
"#{@owner || 'all members'} (#{ENV.fetch('GROWSTUFF_SITE_NAME', nil)})"
|
||||
|
||||
@@ -148,6 +148,19 @@ describe Harvest do
|
||||
end
|
||||
end
|
||||
|
||||
describe '.homepage_records' do
|
||||
it 'returns unique harvests per owner' do
|
||||
member1 = create(:member)
|
||||
member2 = create(:member)
|
||||
create(:harvest, owner: member1, created_at: 1.day.ago)
|
||||
h2 = create(:harvest, owner: member1, created_at: 1.hour.ago)
|
||||
h3 = create(:harvest, owner: member2, created_at: 2.hours.ago)
|
||||
|
||||
records = described_class.homepage_records(5)
|
||||
expect(records).to contain_exactly(h2, h3)
|
||||
end
|
||||
end
|
||||
|
||||
context "stringification" do
|
||||
let(:crop) { create(:crop, name: "apricot") }
|
||||
|
||||
|
||||
@@ -596,16 +596,14 @@ describe Planting do
|
||||
it { expect(member.plantings.active).not_to include(failed_planting) }
|
||||
end
|
||||
|
||||
describe 'homepage', :search do
|
||||
describe 'homepage' do
|
||||
subject { described_class.homepage_records(100) }
|
||||
|
||||
let!(:interesting_planting) { create(:planting, :reindex, :with_photo) }
|
||||
let!(:finished_interesting_planting) { create(:finished_planting, :reindex, :with_photo) }
|
||||
let!(:planting) { create(:planting, :reindex) }
|
||||
|
||||
before { described_class.reindex }
|
||||
let!(:interesting_planting) { create(:planting, :with_photo) }
|
||||
let!(:finished_interesting_planting) { create(:finished_planting, :with_photo) }
|
||||
let!(:planting) { create(:planting) }
|
||||
|
||||
it { expect(subject.count).to eq 3 }
|
||||
it { expect(subject.map(&:id)).to eq([interesting_planting.id.to_s, finished_interesting_planting.id.to_s, planting.id.to_s]) }
|
||||
it { expect(subject.map(&:id)).to include(interesting_planting.id, finished_interesting_planting.id, planting.id) }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -213,16 +213,14 @@ describe Seed do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'homepage', :search do
|
||||
describe 'homepage' do
|
||||
subject { described_class.homepage_records(100) }
|
||||
|
||||
let!(:tradable_seed) { create(:tradable_seed, :reindex, finished: false) }
|
||||
let!(:finished_seed) { create(:tradable_seed, :reindex, finished: true) }
|
||||
let!(:untradable_seed) { create(:untradable_seed, :reindex) }
|
||||
|
||||
before { described_class.reindex }
|
||||
let!(:tradable_seed) { create(:tradable_seed, finished: false) }
|
||||
let!(:finished_seed) { create(:tradable_seed, finished: true) }
|
||||
let!(:untradable_seed) { create(:untradable_seed) }
|
||||
|
||||
it { expect(subject.count).to eq 1 }
|
||||
it { expect(subject.first.id).to eq tradable_seed.id.to_s }
|
||||
it { expect(subject.first.id).to eq tradable_seed.id }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,7 +15,7 @@ describe "Plantings" do
|
||||
before do
|
||||
@member = create(:interesting_member)
|
||||
|
||||
@predictable_planting = create(:predictable_planting, owner: @member, planted_at: 1.days.ago, days_to_first_harvest: 10,
|
||||
@predictable_planting = create(:predictable_planting, owner: @member, planted_at: 1.day.ago, days_to_first_harvest: 10,
|
||||
days_to_last_harvest: 20)
|
||||
@predictable_planting.crop.update(median_days_to_first_harvest: 10)
|
||||
|
||||
@@ -24,7 +24,6 @@ days_to_last_harvest: 20)
|
||||
@finished_planting = create(:finished_planting, owner: @member)
|
||||
@annual_planting = create(:annual_planting, owner: @member)
|
||||
@perennial_planting = create(:perennial_planting, owner: @member)
|
||||
Planting.reindex
|
||||
end
|
||||
|
||||
describe "GET /members/x/plantings.ics" do
|
||||
@@ -34,19 +33,17 @@ days_to_last_harvest: 20)
|
||||
calendar = Icalendar::Parser.new(response.body, true).parse.first
|
||||
expect(calendar.description[0].to_s).to eq "Plantings by #{@member.login_name}"
|
||||
events = calendar.events
|
||||
expect(events.length).to eq 7 # There are 8, but finished plantings aren't included
|
||||
expect(events.length).to eq 7
|
||||
|
||||
# TODO: Better date comparison
|
||||
# Predicted finish should be used
|
||||
expect(events[1].summary.to_s).to include @predictable_planting.crop.name
|
||||
expect(events[1].dtstart.to_datetime.to_i).to be_within(1.second).of @predictable_planting.created_at.to_i
|
||||
expect(events[1].dtend.to_date).to eq @predictable_planting.finish_predicted_at
|
||||
predictable_event = events.find { |e| e.dtend.to_date == @predictable_planting.finish_predicted_at }
|
||||
expect(predictable_event.summary.to_s).to include @predictable_planting.crop.name
|
||||
expect(predictable_event.dtstart.to_datetime.to_i).to be_within(1.second).of @predictable_planting.created_at.to_i
|
||||
|
||||
# Actual finish should be used
|
||||
# expect(events[4].dtend.to_date).to be_within(1.second).of @finised_planting.finished_at
|
||||
# expect(events[4].dtend.to_date).to be_within(1.second).of @finished_planting.finished_at
|
||||
|
||||
# Otherwise, tomorrow should be used
|
||||
expect(events[3].dtend.to_date).to eq 1.day.from_now.to_date
|
||||
expect(events.map { |e| e.dtend.to_date }).to include 1.day.from_now.to_date
|
||||
|
||||
# TBA: Perennial and annual crops predictions of 'next' harvest date don't really fit
|
||||
|
||||
@@ -86,16 +83,18 @@ days_to_last_harvest: 20)
|
||||
data = CSV.parse(response.body, headers: true)
|
||||
expect(data.headers).to eq expected_headers
|
||||
|
||||
expect(data[1]["Crop name"]).to eq @predictable_planting.crop.name
|
||||
expect(data[1]["Owner name"]).to eq @member.to_s
|
||||
expect(data[1]["Garden name"]).to eq @predictable_planting.garden.to_s
|
||||
expect(data[1]["Description"]).to eq @predictable_planting.description
|
||||
expect(data[1]["Date planted"]).to eq @predictable_planting.planted_at.to_fs(:db)
|
||||
expect(data[1]["Quantity"].to_i).to eq @predictable_planting.quantity
|
||||
expect(data[1]["Sunniness"]).to eq @predictable_planting.sunniness
|
||||
expect(data[1]["Planted from"]).to eq @predictable_planting.planted_from
|
||||
expect(data[1]["Date added"]).to eq @predictable_planting.created_at.to_fs(:db)
|
||||
expect(data[1]["License"]).to eq "CC-BY-SA Growstuff http://growstuff.org/"
|
||||
row = data.detect { |crop_name| @predictable_planting.id.to_s == crop_name['Id'] }
|
||||
|
||||
expect(row["Crop name"]).to eq @predictable_planting.crop.name
|
||||
expect(row["Owner name"]).to eq @member.to_s
|
||||
expect(row["Garden name"]).to eq @predictable_planting.garden.to_s
|
||||
expect(row["Description"]).to eq @predictable_planting.description
|
||||
expect(row["Date planted"]).to eq @predictable_planting.planted_at.to_fs(:db)
|
||||
expect(row["Quantity"].to_i).to eq @predictable_planting.quantity
|
||||
expect(row["Sunniness"]).to eq @predictable_planting.sunniness
|
||||
expect(row["Planted from"]).to eq @predictable_planting.planted_from
|
||||
expect(row["Date added"]).to eq @predictable_planting.created_at.to_fs(:db)
|
||||
expect(row["License"]).to eq "CC-BY-SA Growstuff http://growstuff.org/"
|
||||
|
||||
expect(data.count).to eq 6
|
||||
end
|
||||
|
||||
@@ -46,9 +46,6 @@ RSpec.configure do |config|
|
||||
def index_everything
|
||||
# reindex models
|
||||
Crop.reindex
|
||||
Harvest.reindex
|
||||
Planting.reindex
|
||||
Seed.reindex
|
||||
end
|
||||
|
||||
config.before(:suite) do
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe 'harvests/index.rss.haml', :search do
|
||||
describe 'harvests/index.rss.haml' do
|
||||
before do
|
||||
controller.stub(:current_user) { nil }
|
||||
@member = create(:member)
|
||||
@@ -12,8 +12,7 @@ describe 'harvests/index.rss.haml', :search do
|
||||
@harvest2 = create(:harvest, crop: @tomato)
|
||||
@harvest3 = create(:harvest, crop: @tomato)
|
||||
|
||||
Harvest.searchkick_index.refresh
|
||||
assign(:harvests, Harvest.search(load: false))
|
||||
assign(:harvests, Harvest.all)
|
||||
end
|
||||
|
||||
context 'all harvests' do
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe 'home/_seeds.html.haml', :search, type: "view" do
|
||||
describe 'home/_seeds.html.haml', type: "view" do
|
||||
let!(:seed) { create(:tradable_seed, owner:) }
|
||||
let(:owner) { create(:london_member) }
|
||||
|
||||
before do
|
||||
Seed.searchkick_index.refresh
|
||||
render
|
||||
end
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe 'plantings/index.rss.haml', :search do
|
||||
describe 'plantings/index.rss.haml' do
|
||||
before do
|
||||
controller.stub(:current_user) { nil }
|
||||
allow(view).to receive(:current_user).and_return(nil)
|
||||
end
|
||||
|
||||
context 'all plantings' do
|
||||
@@ -12,8 +12,7 @@ describe 'plantings/index.rss.haml', :search do
|
||||
@planting = create(:planting)
|
||||
@sunny = create(:sunny_planting)
|
||||
@seedling = create(:seedling_planting)
|
||||
Planting.searchkick_index.refresh
|
||||
assign(:plantings, Planting.search(load: false))
|
||||
assign(:plantings, Planting.all)
|
||||
render
|
||||
end
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe 'seeds/index.rss.haml', :search do
|
||||
describe 'seeds/index.rss.haml' do
|
||||
before do
|
||||
controller.stub(:current_user) { nil }
|
||||
end
|
||||
@@ -26,8 +26,7 @@ describe 'seeds/index.rss.haml', :search do
|
||||
let!(:tradable) { create(:tradable_seed) }
|
||||
|
||||
before do
|
||||
Seed.searchkick_index.refresh
|
||||
assign(:seeds, Seed.search(load: false))
|
||||
assign(:seeds, Seed.all)
|
||||
render
|
||||
end
|
||||
|
||||
@@ -51,8 +50,7 @@ describe 'seeds/index.rss.haml', :search do
|
||||
|
||||
before do
|
||||
assign(:owner, seed.owner)
|
||||
Seed.searchkick_index.refresh
|
||||
assign(:seeds, Seed.search(load: false))
|
||||
assign(:seeds, Seed.all)
|
||||
render
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user