Fix bug in update_campaign: remove duplicate campaign_name check#17
Open
cameronehrlich wants to merge 1 commit intophiture:masterfrom
Open
Fix bug in update_campaign: remove duplicate campaign_name check#17cameronehrlich wants to merge 1 commit intophiture:masterfrom
cameronehrlich wants to merge 1 commit intophiture:masterfrom
Conversation
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.
There was a problem hiding this comment.
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 assignededit["status"] = campaign_name. - Left the existing
if status: edit["status"] = statuslogic unchanged so status updates work as intended.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixed a bug in the
update_campaignmethod wherecampaign_namewas being checked twice and incorrectly assigned to thestatusfield.The Bug
Impact
Any call to
update_campaign()with acampaign_nameparameter would incorrectly set the campaign'sstatusto the campaign name string (e.g., "My Campaign") instead of a valid status like "ENABLED" or "PAUSED".The
statuswould then get overwritten if thestatusparameter was also provided, but if onlycampaign_namewas passed, the API call would fail or produce unexpected results.Fix
Removed the duplicate
if campaign_name:block that incorrectly assigned tostatus. The correctif status: edit["status"] = statusalready exists below.Testing