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

[O2B-719] Add range based filtering for run number #1810

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

hattinf
Copy link
Collaborator

@hattinf hattinf commented Dec 5, 2024

I have a JIRA ticket

  • branch and/or PR name(s) include(s) JIRA ID
  • issue has "Fix version" assigned
  • issue "Status" is set to "In review"
  • PR labels are selected

Notable changes for users:
-runNumber filter now accepts ranges as well

Notable changes for developers:

Changes made to the database:

@hattinf hattinf added the backend label Dec 5, 2024
@hattinf hattinf self-assigned this Dec 5, 2024
Copy link

codecov bot commented Dec 5, 2024

Codecov Report

Attention: Patch coverage is 96.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 43.95%. Comparing base (119a6f0) to head (a0037ae).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
lib/domain/dtos/filters/RunFilterDto.js 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1810      +/-   ##
==========================================
- Coverage   44.07%   43.95%   -0.12%     
==========================================
  Files         889      889              
  Lines       15862    15885      +23     
  Branches     2990     2997       +7     
==========================================
- Hits         6991     6983       -8     
- Misses       8871     8902      +31     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

lib/usecases/run/GetAllRunsUseCase.js Outdated Show resolved Hide resolved
lib/usecases/run/GetAllRunsUseCase.js Outdated Show resolved Hide resolved
@hattinf hattinf requested a review from martinboulais December 9, 2024 11:21
@martinboulais
Copy link
Collaborator

The idea is good, but there is a major flaw: when using a very big range (with prod data) the app simply crash because the list of run numbers is too big.
A possible solution is to limit the range, for example to 100 (please read Joi documentation to put it in the DTO).
The best solution would be to use min and max SQL function for run, but I am not sure we can properly do that with the current query builder.

@martinboulais martinboulais changed the title [O2B-719] add range based filtering for run number [O2B-719] Add range based filtering for run number Dec 11, 2024
const rangeSize = end - start + 1;

if (rangeSize > MAX_RANGE_SIZE) {
return helpers.error('any.invalid', { message: `Range exceeds max size of 100 runs: ${runNumber}` });
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should use the constant also in the error message

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

Successfully merging this pull request may close these issues.

3 participants