stricter tests for broken scraper check and better query#1188
Merged
fbacall merged 2 commits intoDec 4, 2025
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a broken scraper check query that was incorrectly filtering content providers with stale events or materials, and adds comprehensive test coverage for the new query logic. The old query used WHERE clauses with LEFT JOIN which would incorrectly handle providers with only events or only materials, or providers with no content at all. The new implementation correctly identifies providers that have at least one event or material, but all of them have an updated_at timestamp before the cutoff time.
Key Changes
- Extracted the broken scraper detection logic into a new
ContentProvider.with_broken_scrapersclass method - Fixed the SQL query to properly handle edge cases using HAVING clauses with conditional COUNT checks
- Added 8 comprehensive tests covering various scenarios including empty providers, events-only, materials-only, mixed content, and title filtering
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| test/mailers/curation_mailer_test.rb | Adds new test class with comprehensive test coverage for the with_broken_scrapers method |
| app/models/content_provider.rb | Implements new with_broken_scrapers class method with corrected SQL query logic |
| app/mailers/curation_mailer.rb | Refactors to use the new model method instead of inline query |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fbacall
approved these changes
Dec 4, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of changes
Fix broken scraper check.
Add more tests for query function.
Checklist
to license it to the TeSS codebase under the
BSD license.