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

Parse input as numeric when a numeric comparison is requested #663

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from

Conversation

acoffman
Copy link
Member

@acoffman acoffman commented Dec 7, 2020

In the advanced search, if a user enters a non-numeric value when requesting a numeric comparison, it will generate a (still safe but) invalid SQL statement which will cause an exception. (https://griffithlab-apps.airbrake.io/projects/285901/groups/2894318614931625648/notices/2894318613519076496)

Ideally we'd do more validation client side and server side and kick back a more user friendly error in this case, but as a stopgap this will at least ensure the prepared SQL is valid and no error will occur.

@coveralls
Copy link

coveralls commented Dec 7, 2020

Pull Request Test Coverage Report for Build 406415571

  • 0 of 16 (0.0%) changed or added relevant lines in 1 file are covered.
  • 36 unchanged lines in 23 files lost coverage.
  • Overall coverage decreased (-0.008%) to 15.921%

Changes Missing Coverage Covered Lines Changed/Added Lines %
app/models/advanced_searches/base.rb 0 16 0.0%
Files with Coverage Reduction New Missed Lines %
app/controllers/genes_controller.rb 1 83.54%
app/models/comment.rb 1 63.64%
app/models/concerns/moderated.rb 1 74.24%
app/models/concerns/with_countable_enum.rb 1 90.0%
app/models/disease.rb 1 69.23%
app/models/drug.rb 1 56.25%
app/models/evidence_item.rb 1 81.63%
app/models/gene.rb 1 84.21%
app/models/notification.rb 1 62.5%
app/models/on_site_subscription.rb 1 40.0%
Totals Coverage Status
Change from base Build 399074882: -0.008%
Covered Lines: 2111
Relevant Lines: 13259

💛 - Coveralls

'is_greater_than',
'is_greater_than_or_equal_to',
'is_less_than_or_equal_to',
'is_in_the_range'
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we're missing is_equal (or whatever the equivalent is).

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.

3 participants