Skip to content

Commit

Permalink
Merge pull request #2748 from alphagov/warn-filter-editions
Browse files Browse the repository at this point in the history
Add a warning and a TODO for the filter_editions method
  • Loading branch information
richardTowers authored May 29, 2024
2 parents ace70a4 + cd16f79 commit a33f6dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 6 additions & 0 deletions app/models/link.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ class Link < ApplicationRecord
validate :association_presence

def self.filter_editions(scope, filters)
if filters.size > 1
# TODO: richard.towers - temporary warning to check whether this method is ever
# called with multiple filters. The code looks wrong, so if it's not being
# called we should make this an error and only support a single filter.
logger.warn("filter_editions called with multiple filters. These will be ANDed together in a way that probably isn't what we want. Filters were: #{filters.inspect}")
end
join_sql = <<-SQL.strip_heredoc
INNER JOIN link_sets ON link_sets.content_id = documents.content_id
INNER JOIN links ON links.link_set_id = link_sets.id
Expand Down
3 changes: 1 addition & 2 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,7 @@ and a state has been specified, the draft is returned.
e.g. `link_organisations=056a9ff6-2ed1-4942-9f06-92df03da741d`
will restrict the documents returned to those that have a link
with type `organisations` to the document with specified content
id. Query parameters matching this form can be specified multiple
times.
id.
- `locale` *(optional, default "en")*
- Accepts: An available locale from the [Rails I18n gem][i18n-gem]
- Used to restrict documents to a given locale.
Expand Down

0 comments on commit a33f6dc

Please sign in to comment.