-
Notifications
You must be signed in to change notification settings - Fork 113
fix enddate for linkedin #501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughWalkthroughModified lead_form_responses to use an integer millisecond epoch timestamp for endDate when end_value is absent, replacing a UTC datetime object in the submittedAtTimeRange construction. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Comments (1)
-
ingestr/src/linkedin_ads/__init__.py, line 184 (link)syntax: Missing
int()wrapper causes float timestamp
1 file reviewed, 1 comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@ingestr/src/linkedin_ads/__init__.py`:
- Around line 190-193: The ternary for computing toDate uses truthiness on
submittedAt.end_value which wrongly treats 0 as missing; change the check to
explicit None comparison (use "submittedAt.end_value is not None") so toDate
uses the provided 0/epoch value when present and only falls back to
pendulum.now() when end_value is None; update the expression around toDate and
the referenced symbol submittedAt.end_value accordingly.
| toDate = ( | ||
| submittedAt.end_value if submittedAt.end_value else pendulum.now(tz="UTC") | ||
| submittedAt.end_value | ||
| if submittedAt.end_value | ||
| else int(pendulum.now(tz="UTC").int_timestamp * 1000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guard end_value with is not None instead of truthiness.
submittedAt.end_value could be 0 (epoch) in tests or edge cases, which would incorrectly fall back to now. Use an explicit None check.
Suggested fix
- toDate = (
- submittedAt.end_value
- if submittedAt.end_value
- else int(pendulum.now(tz="UTC").int_timestamp * 1000)
- )
+ toDate = (
+ submittedAt.end_value
+ if submittedAt.end_value is not None
+ else int(pendulum.now(tz="UTC").int_timestamp * 1000)
+ )📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| toDate = ( | |
| submittedAt.end_value if submittedAt.end_value else pendulum.now(tz="UTC") | |
| submittedAt.end_value | |
| if submittedAt.end_value | |
| else int(pendulum.now(tz="UTC").int_timestamp * 1000) | |
| toDate = ( | |
| submittedAt.end_value | |
| if submittedAt.end_value is not None | |
| else int(pendulum.now(tz="UTC").int_timestamp * 1000) | |
| ) |
🤖 Prompt for AI Agents
In `@ingestr/src/linkedin_ads/__init__.py` around lines 190 - 193, The ternary for
computing toDate uses truthiness on submittedAt.end_value which wrongly treats 0
as missing; change the check to explicit None comparison (use
"submittedAt.end_value is not None") so toDate uses the provided 0/epoch value
when present and only falls back to pendulum.now() when end_value is None;
update the expression around toDate and the referenced symbol
submittedAt.end_value accordingly.
Note
Fixes time range handling for LinkedIn lead form responses.
lead_form_responses, whensubmittedAt.end_valueis missing,toDatenow defaults toint(pendulum.now(tz="UTC").int_timestamp * 1000)to match the API’s millisecond expectationsubmittedAtvalues to prevent mismatched timestamp unitsWritten by Cursor Bugbot for commit 0fe97c0. This will update automatically on new commits. Configure here.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.