This commit configures the sitemap generation process to upload the sitemap to an S3 bucket instead of the local filesystem.
It introduces the `aws-sdk-s3` gem to handle the S3 communication. A new configuration file, `config/sitemap.rb`, has been added to define the S3 adapter and specify the models to be included in the sitemap. The S3 bucket, access keys, and region are configured via environment variables.
Adds the `sitemap_generator` gem to generate a sitemap.
- Includes static routes and dynamic routes for active crops, plantings, seeds, photos, posts, and members.
- Implements a caching mechanism to ensure the sitemap is generated no more frequently than every 72 hours.
- Updates `robots.txt` to point to the new sitemap.
- Includes a unit test for the caching Rake task.
This commit improves the meta descriptions for several pages by making them dynamic and object-specific.
- The default meta description in `app/views/layouts/_head.html.haml` has been updated to include a mention of open data.
- The `show.html.haml` views for crops, seeds, plantings, harvests, and members now have a `content_for :meta_description` block. This block uses the object's description or bio if available, and falls back to a generated string if not.
This change adds the `rack-deflater` gem to the project and configures the application to use it. This will enable gzip compression for HTTP responses, improving performance by reducing the size of the data sent to the client.
This commit addresses two issues in the nutritional data view:
1. **Fixes String Interpolation:** The HAML template incorrectly used an escaped hash (`\#{...}`) in string interpolations, which prevented the nutritional values from being rendered. This has been corrected by removing the backslash.
2. **Adds AFCD Name:** The view now displays the `food_name` from the Australian Food Classification Data to provide more context to the user.
This commit introduces a new partial to display nutritional data from the Australian Food Composition Database.
Key changes:
- Adds a database index to the `public_food_key` on the `crops` table.
- Establishes a `has_one` relationship between `Crop` and `AustralianFoodClassificationData`.
- Creates a `_nutritional_data.html.haml` partial to display a summary of key nutritional information.
- Renders the partial on the `show` pages for both crops and harvests.
Improves the `wikidata:import_alternate_names` Rake task to first use the `wikidata_id` from the `scientific_names` table.
- Checks for a `wikidata_id` on a crop's `scientific_names`.
- Falls back to the existing `en_wikipedia_url` if no `wikidata_id` is found.
- Adds logging to indicate the source of the Wikidata ID.
- Improves error handling.
Improves the `wikidata:import_alternate_names` Rake task to first look up a crop's Wikidata ID using its scientific names.
- Iterates through a crop's scientific names to find a Wikidata ID.
- Falls back to the existing `en_wikipedia_url` if no ID is found via scientific names.
- Adds more detailed logging to the task.
- Improves error handling by checking for non-existent Wikipedia pages and using `.dig` for safer hash access.
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.
* Check presence of version members before accessing
* Fix(specs): Initialize @version_members in crops/show view spec
The `crops/show` view spec was failing with a `NoMethodError` because
the `@version_members` instance variable was `nil`. This variable is used
in the `_history` partial, which is rendered by the `show` view.
This commit fixes the spec by initializing `@version_members` to an
empty hash in the `before` block of the spec. This ensures that the
view can render without errors during the test run.
* Remove defunct gitter
* Merge pull request #4352 from Growstuff/add-public-food-key
feat: Add Public Food Key to Crop model
* Bump rubocop-rails from 2.34.1 to 2.34.2
Bumps [rubocop-rails](https://github.com/rubocop/rubocop-rails) from 2.34.1 to 2.34.2.
- [Release notes](https://github.com/rubocop/rubocop-rails/releases)
- [Changelog](https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-rails/compare/v2.34.1...v2.34.2)
---
updated-dependencies:
- dependency-name: rubocop-rails
dependency-version: 2.34.2
dependency-type: direct:development
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
* 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>
* Merge pull request #4353 from Growstuff/feat/import-australian-food-data
Add Rake Task to Import Australian Food Data
* Fix styling
---------
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>