Skip to content

Conversation

@landomen
Copy link
Contributor

@landomen landomen commented Dec 22, 2025

Task/Issue URL: https://app.asana.com/1/137249556945/project/1210594645151737/task/1212221190455658?focus=true

Description

Fixes duplicated broker names in the "Next up" section of the "Scan Schedule" bottom sheet. This happens with multiple profile queries when same brokers are scanned multiple times.

Steps to test this PR

  • Complete an initial scan for a profile
  • Add a second name to the profile and finish the scan again
  • Click on the "Recent scans" card and verify there are no duplicated broker names in the "Next Up" section

UI changes

No UI changes


Note

Deduplicates broker matches by broker name in dashboard scan details and adds tests to ensure a single entry per broker across profile queries.

  • PIR dashboard scan data:
    • Deduplicate broker matches in getBrokerMatches by broker.name after sorting by dateInMillis, preventing duplicate entries when multiple profile queries/opt-outs exist for the same broker.
  • Tests:
    • Add unit tests ensuring only one DashboardBrokerMatch per broker for both last and next scan details when multiple profile queries are present.

Written by Cursor Bugbot for commit 8006a2a. This will update automatically on new commits. Configure here.

return (validScansJobs + mirrorValidScanJobs).sortedBy { it.dateInMillis }
return (validScansJobs + mirrorValidScanJobs)
.sortedBy { it.dateInMillis }
.distinctBy { it.broker.name }
Copy link

Choose a reason for hiding this comment

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

Deduplication keeps oldest scan instead of most recent

The getBrokerMatches function is shared between getLastScanDetails() and getNextScanDetails(). By applying .sortedBy { it.dateInMillis } followed by .distinctBy { it.broker.name }, the code keeps the earliest (oldest) entry for each broker. This is correct for getNextScanDetails() (shows when broker will next be scanned), but for getLastScanDetails(), it keeps the oldest scan instead of the most recent one. When multiple profile queries exist for the same broker with different scan dates, users would see an older scan date rather than when the broker was actually last scanned.

Fix in Cursor Fix in Web

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.

2 participants