-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat(disasters panel): 20511 Added config-based filters by last N days (updatedAt and startedAt fields) #942
feat(disasters panel): 20511 Added config-based filters by last N days (updatedAt and startedAt fields) #942
Conversation
…s (updatedAt and startedAt fields)
WalkthroughThe pull request introduces enhanced event filtering capabilities by adding two new functions, Changes
Sequence DiagramsequenceDiagram
participant User
participant EventList
participant FilterHelpers
participant Events
User->>EventList: Apply filters
EventList->>FilterHelpers: filterByLastNDaysUpdatedAt/StartedAt
FilterHelpers->>FilterHelpers: Calculate min timestamp
FilterHelpers->>Events: Filter events within time range
FilterHelpers-->>EventList: Filtered events
EventList-->>User: Display filtered events
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Bundle size diff
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #942 +/- ##
========================================
- Coverage 9.44% 9.43% -0.02%
========================================
Files 677 677
Lines 29388 29421 +33
Branches 1187 1187
========================================
Hits 2777 2777
- Misses 26074 26107 +33
Partials 537 537
☔ View full report in Codecov by Sentry. |
Preview environments for this PR:
These previews are automatically updated with each commit. Note: After a new deployment, it may take a few minutes for the changes to propagate and for caches to update. During this time, you might experience temporary loading issues or see an older version of the app. If the app fails to load, please wait a few minutes and try again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
src/features/events_list/atoms/sortedEventList.ts
(2 hunks)src/features/events_list/helpers/localEventFilters.ts
(2 hunks)src/features/events_list/types.ts
(1 hunks)
🔇 Additional comments (10)
src/features/events_list/types.ts (1)
11-14
: Confirm priority note for date filters.
The comments clearly indicate that minUpdatedAt
and minStartedAt
take precedence over their corresponding lastNDays*
counterparts. This is logical and well-documented. Ensure the same behavior is consistently enforced in the application code, and consider adding test coverage to confirm the precedence logic.
src/features/events_list/helpers/localEventFilters.ts (5)
4-10
: Consider edge cases for day calculations.
Your approach to filtering by last N days is clear; however, watch out for edge cases like days = 0
or negative values, and events that have an invalid or missing date. You might also consider how time zones could affect the comparison if your environment must handle multiple time zones.
12-18
: Maintain consistent approach for startedAt filter.
This parallels the filterByLastNDaysUpdatedAt
function effectively. Again, be mindful of invalid or missing date values.
23-23
: Reuse of filterByMinTime
is a solid improvement.
This refactoring increases clarity and reduces repetition. Good job!
31-31
: Refactoring with filterByMinTime
ensures DRY principle.
Consistent usage of filterByMinTime
fosters cleaner and more maintainable code.
75-85
: Null or invalid date handling.
filterByMinTime
skips events that have invalid or absent date fields and excludes them from the results. This seems appropriate, but ensure that data consumers understand that such events are effectively filtered out.
src/features/events_list/atoms/sortedEventList.ts (4)
9-10
: Imports effectively extend filtering capabilities.
The newly imported functions align with the added filter properties. This maintains a clear structure and usage.
61-61
: Good practice to group date filters in a dedicated block.
Keeping related filters together enhances readability and discoverability of the code.
64-65
: Conditionally apply last N days updatedAt filter.
This correctly respects the documented priority of minUpdatedAt
over lastNDaysUpdatedAt
.
69-70
: Conditionally apply last N days startedAt filter.
Likewise, minStartedAt
takes precedence over lastNDaysStartedAt
. This is consistent with the intended filtering logic.
Bundle ReportChanges will increase total bundle size by 378 bytes (0.01%) ⬆️. This is within the configured threshold ✅ Detailed changes
|
https://kontur.fibery.io/Tasks/Task/FE-Last-N-days-filter-for-startedAt-and-updatedAt-fields-20511
Summary by CodeRabbit
New Features
Bug Fixes
Documentation