Skip to content

Fix bug in update_campaign: remove duplicate campaign_name check#17

Open
cameronehrlich wants to merge 1 commit intophiture:masterfrom
cameronehrlich:fix/update-campaign-status-bug
Open

Fix bug in update_campaign: remove duplicate campaign_name check#17
cameronehrlich wants to merge 1 commit intophiture:masterfrom
cameronehrlich:fix/update-campaign-status-bug

Conversation

@cameronehrlich
Copy link
Copy Markdown

Summary

Fixed a bug in the update_campaign method where campaign_name was being checked twice and incorrectly assigned to the status field.

The Bug

if campaign_name:
    edit["name"] = campaign_name
if campaign_name:  # Bug: duplicate check
    edit["status"] = campaign_name  # Bug: assigns name to status field
if adamId:
    edit["adamId"] = adamId
if status:
    edit["status"] = status  # Correct status handling already exists

Impact

Any call to update_campaign() with a campaign_name parameter would incorrectly set the campaign's status to the campaign name string (e.g., "My Campaign") instead of a valid status like "ENABLED" or "PAUSED".

The status would then get overwritten if the status parameter was also provided, but if only campaign_name was passed, the API call would fail or produce unexpected results.

Fix

Removed the duplicate if campaign_name: block that incorrectly assigned to status. The correct if status: edit["status"] = status already exists below.

Testing

  • Verified the change removes only the buggy duplicate block
  • Confirmed the correct status handling remains intact (lines 350-351 in the fixed code)

The update_campaign method had a bug where `campaign_name` was being
checked twice and incorrectly assigned to the `status` field:

```python
if campaign_name:
    edit["name"] = campaign_name
if campaign_name:  # Bug: should not exist
    edit["status"] = campaign_name  # Bug: wrong value assigned to status
```

This caused any campaign update with a name to also incorrectly set
the status to the campaign name string instead of a valid status value.

The correct `if status: edit["status"] = status` already exists below,
so this duplicate block was simply removed.
Copilot AI review requested due to automatic review settings January 23, 2026 22:14
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an incorrect assignment in update_campaign where the campaign_name parameter was mistakenly being written into the status field, causing invalid campaign status values. The change removes the buggy duplicate if campaign_name: block while keeping the correct status handling intact.

Changes:

  • Removed the erroneous if campaign_name: block that assigned edit["status"] = campaign_name.
  • Left the existing if status: edit["status"] = status logic unchanged so status updates work as intended.

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

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