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

[WIP] Add advanced filters to admin budget investments #1956

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

microweb10
Copy link
Collaborator

⚠️ Rebase with master once this PR is merged #1955

References

This is an upstream of PR consuldemocracy#3351 and PR consuldemocracy#3364

Objectives

Change filters on /admin/budgets/:id/budget_investments . We want to move filters from tabs to checkboxes into advanced filters component to give admin the ability of join some of them as filters

  • Change tab filters to checkboxes
  • Filters can be combined

Add a new advanced filter on admin budgets investments for maximum number of supports

Visual Changes

Before:
image

After:
image

image


click_link('Next')

expect(page).to have_link('Previous')

Choose a reason for hiding this comment

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

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. (https://github.com/bbatsov/ruby-style-guide#consistent-string-literals)

click_link('Selected')
end

click_link('Next')

Choose a reason for hiding this comment

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

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. (https://github.com/bbatsov/ruby-style-guide#consistent-string-literals)

visit admin_budget_budget_investments_path(budget)

within("#budget_investment_#{selected_bi.id}") do
click_link('Selected')

Choose a reason for hiding this comment

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

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. (https://github.com/bbatsov/ruby-style-guide#consistent-string-literals)

@@ -1357,6 +1555,7 @@
click_link("Selected")
end

click_button('Filter')

Choose a reason for hiding this comment

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

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. (https://github.com/bbatsov/ruby-style-guide#consistent-string-literals)

results = results.without_admin if params[:advanced_filters].include?("without_admin")
results = results.without_valuator if params[:advanced_filters].include?("without_valuator")
results = results.under_valuation if params[:advanced_filters].include?("under_valuation")
results = results.valuation_finished if params[:advanced_filters].include?("valuation_finished")

Choose a reason for hiding this comment

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

Metrics/LineLength: Line is too long. [102/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)

params[:min_total_supports]) if params[:min_total_supports].present?
params[:min_total_supports]) if params[:min_total_supports].present?
results = results.where("cached_votes_up + physical_votes <= ?",
params[:max_total_supports]) if params[:max_total_supports].present?

Choose a reason for hiding this comment

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

Metrics/LineLength: Line is too long. [114/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)

@@ -122,7 +122,9 @@ def self.scoped_filter(params, current_filter)
results = Investment.by_budget(budget)

results = results.where("cached_votes_up + physical_votes >= ?",
params[:min_total_supports]) if params[:min_total_supports].present?
params[:min_total_supports]) if params[:min_total_supports].present?

Choose a reason for hiding this comment

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

Metrics/LineLength: Line is too long. [114/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)

@microweb10 microweb10 force-pushed the admin_budget_investments_advanced_filters branch from 66e8caf to 3e8ae68 Compare May 29, 2019 16:47
params[:min_total_supports]) if params[:min_total_supports].present?
params[:min_total_supports]) if params[:min_total_supports].present?
results = results.where("cached_votes_up + physical_votes <= ?",
params[:max_total_supports]) if params[:max_total_supports].present?

Choose a reason for hiding this comment

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

Metrics/LineLength: Line is too long. [114/110] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)

@@ -122,7 +122,9 @@ def self.scoped_filter(params, current_filter)
results = Investment.by_budget(budget)

results = results.where("cached_votes_up + physical_votes >= ?",
params[:min_total_supports]) if params[:min_total_supports].present?
params[:min_total_supports]) if params[:min_total_supports].present?

Choose a reason for hiding this comment

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

Metrics/LineLength: Line is too long. [114/110] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants