Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions backend/analytics_server/mhq/exapi/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
)
from mhq.exapi.models.github import GitHubContributor
from mhq.exapi.models.github_timeline import GithubPullRequestTimelineEvents
from mhq.store.models.code.enums import PullRequestEventType
from mhq.utils.log import LOG

PAGE_SIZE = 100
Expand Down Expand Up @@ -373,11 +374,10 @@ def _adapt_github_timeline_events(

event = GithubPullRequestTimelineEvents(event_type, event_data)

if all([event.timestamp, event.type, event.id, event.user]):
if (
all([event.timestamp, event.type, event.id, event.user])
and event.type != PullRequestEventType.COMMITTED
):
Comment on lines +377 to +380

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.

🛠️ Refactor suggestion

Consider adding test coverage for the COMMITTED event exclusion.

The filtering logic successfully excludes COMMITTED events from the adapted timeline, which aligns with the PR objectives. However, consider adding unit tests to verify this behavior works correctly and prevents potential regressions.

Would you like me to generate unit tests for this filtering logic to ensure COMMITTED events are properly excluded?

🤖 Prompt for AI Agents
In backend/analytics_server/mhq/exapi/github.py around lines 377 to 380, the
code filters out events of type COMMITTED from the adapted timeline. To ensure
this exclusion works correctly and to prevent regressions, add unit tests that
specifically create events with type COMMITTED and verify they are excluded by
the filtering logic. Also, include tests for other event types to confirm they
are included as expected.

adapted_timeline_events.append(event)
else:
LOG.warning(
f"Skipping incomplete timeline event: {event_type} with id: {event.id}"
)

return adapted_timeline_events