Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions src/django_project/tests/unit/web/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ def setUp(self):
)
self.group.links.add(self.link)

@patch("web.tasks.get_events_for_organization")
def test_returns_clear_result_when_platform_link_is_missing(self, mock_get_events_for_organization):
self.group.links.remove(self.link)

result = ingest_future_eventbrite_events(self.group.pk)

self.assertEqual(result, f"no Eventbrite links found for {self.group.name}")
mock_get_events_for_organization.assert_not_called()

@patch("web.tasks.get_event_details")
@patch("web.tasks.get_events_for_organization")
def test_ingests_event_without_primary_venue(self, mock_get_events_for_organization, mock_get_event_details):
Expand Down
4 changes: 3 additions & 1 deletion src/django_project/web/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ def ingest_future_eventbrite_events(group_pk) -> str:
if not group:
return f"group with pk {group_pk} not found"
event_count = 0
link: Any = group.links.filter(name=f"{group.name} {group.platform.name} page").distinct()[0]
link: Any = group.links.filter(name=f"{group.name} {group.platform.name} page").distinct().first()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: When a group has multiple matching Eventbrite links, .first() processes only one organization and silently skips events from the remaining organizations.

Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Incomplete implementation

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** src/django_project/web/tasks.py
**Line:** 145:145
**Comment:**
	*Incomplete Implementation: When a group has multiple matching Eventbrite links, `.first()` processes only one organization and silently skips events from the remaining organizations.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

if not link:
return f"no {group.platform.name} links found for {group.name}"
eb_group_id: str = link.url.split("-")[-1]
event_list: list = get_events_for_organization(eb_group_id)
for item in event_list:
Expand Down
Loading