Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sql based filters #6

Merged
merged 1 commit into from
Mar 23, 2015
Merged

Add sql based filters #6

merged 1 commit into from
Mar 23, 2015

Conversation

TobiasBales
Copy link
Contributor

No description provided.

@@ -0,0 +1,45 @@
module FortyFacets
class ScopeFacetFilterDefinition < FilterDefinition

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra empty line detected at class body beginning.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.4%) to 91.28% when pulling 6cd6243 on scope_filters into d67f905 on master.

assert_equal 6, search.result.size
search = MovieSearch.new("search" => { "classics" => "non_classics" })
assert_equal 34, search.result.size
search = MovieSearch.new("search" => { "classics" => ["non_classics", "classics"] })

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [88/80]

@coveralls
Copy link

Coverage Status

Coverage increased (+0.42%) to 91.3% when pulling 6d290a4 on scope_filters into d67f905 on master.

end

def facet
query = definition.queries.map { |key, query| "(#{query}) as #{key}" }.join(', ')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shadowing outer local variable - query.
Line is too long. [89/80]
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

counts.map do |count|
definition.queries.each do |key, _|
result[key] ||= 0
result[key] += count.occurrences if [1, '1', true].include?(count[key])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [83/80]
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@TobiasBales TobiasBales changed the title Add scope based filters Add sql based filters Mar 23, 2015

counts = without.result.reorder("")
.select(query)
.group(definition.queries.keys)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Place the . on the previous line, together with the method call receiver.
Align the operands of an expression in an assignment spanning multiple lines.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.09%) to 89.8% when pulling 518c57a on scope_filters into d67f905 on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.02%) to 89.86% when pulling 4cdd532 on scope_filters into d67f905 on master.

axelerator added a commit that referenced this pull request Mar 23, 2015
@axelerator axelerator merged commit 0a5e372 into master Mar 23, 2015
@axelerator axelerator deleted the scope_filters branch March 23, 2015 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants