Skip to content

fix: Improve data filtering logic and simplify date range checks in PlaybackPerformanceDashboard - #2056

Merged
KMchaudhary merged 1 commit into
developfrom
hotfix/dev-main-feedback
Jul 30, 2026
Merged

fix: Improve data filtering logic and simplify date range checks in PlaybackPerformanceDashboard#2056
KMchaudhary merged 1 commit into
developfrom
hotfix/dev-main-feedback

Conversation

@KMchaudhary

Copy link
Copy Markdown
Collaborator

This pull request includes several small but important improvements to the analytics dashboard and image rendering code. The main changes focus on simplifying code, improving filtering logic, and minor code style adjustments.

Analytics dashboard improvements:

  • Simplified the filtering logic in PlaybackPerformanceDashboard by removing unnecessary fallback to an empty array when filtering parsedData, ensuring filteredData is always an array.
  • In DateRangePicker, simplified the condition for starting a new date range selection, making the code more readable and reliable.

Code style and maintainability:

  • Added a phpcs:ignore comment in godam-image/render.php to clarify the inclusion of a build asset file, improving maintainability and code clarity.

Copilot AI review requested due to automatic review settings July 30, 2026 11:09
@KMchaudhary
KMchaudhary merged commit b4b3934 into develop Jul 30, 2026
2 of 5 checks passed
@KMchaudhary
KMchaudhary deleted the hotfix/dev-main-feedback branch July 30, 2026 11:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Improves analytics dashboard data handling and date range selection readability, plus adds a PHPCS ignore for a build-asset include in the image block renderer.

Changes:

  • Simplified date-range “start new range” condition in DateRangePicker.
  • Removed || [] fallback when deriving filteredData in PlaybackPerformanceDashboard.
  • Added phpcs:ignore comment for including the generated asset metadata file in godam-image render code.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
pages/analytics/components/DateRangePicker/index.js Simplifies condition used to start a new date-range selection.
pages/analytics/PlaybackPerformance.js Removes empty-array fallback when filtering/assigning parsedData into filteredData.
assets/src/blocks/godam-image/render.php Adds PHPCS ignore rationale for including a build-generated asset file via a variable path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 165 to 176
if ( rangeActive ) {
startDate = fromISO( range.startDate );
endDate = fromISO( range.endDate );
filteredData = ( parsedData || [] ).filter( ( d ) => {
filteredData = parsedData.filter( ( d ) => {
const t = new Date( d.date );
return t >= startDate && t <= endDate;
} );
} else {
filteredData = parsedData || [];
filteredData = parsedData;
startDate =
filteredData.length > 0
? d3.min( filteredData, ( d ) => d.date )
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