Skip to content

feat: daily estimated reach#2946

Merged
sshanzel merged 14 commits intomainfrom
MI-961-reach
Jul 30, 2025
Merged

feat: daily estimated reach#2946
sshanzel merged 14 commits intomainfrom
MI-961-reach

Conversation

@sshanzel
Copy link
Contributor

@sshanzel sshanzel commented Jul 29, 2025

The API for estimated reach can now accept budget and duration optionally.

When those parameters are present, we will send back a different calculation compared to the original one.

Note: the diff on the test file is huge. Rather than mocking the api client, I am mocking the request directly to have a better look of what we are sending and what we are receiving.

Jira ticket

MI-961

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bugbot free trial expires on July 31, 2025
Learn more in the Cursor dashboard.

Comment bugbot run to trigger another review on this PR

@pulumi
Copy link

pulumi bot commented Jul 29, 2025

🍹 The Update (preview) for dailydotdev/api/prod (at 91856af) was successful.

Resource Changes

    Name                                            Type                           Operation
~   vpc-native-update-source-public-threshold-cron  kubernetes:batch/v1:CronJob    update
~   vpc-native-update-trending-cron                 kubernetes:batch/v1:CronJob    update
~   vpc-native-sync-subscription-with-cio-cron      kubernetes:batch/v1:CronJob    update
~   vpc-native-update-highlighted-views-cron        kubernetes:batch/v1:CronJob    update
~   vpc-native-personalized-digest-cron             kubernetes:batch/v1:CronJob    update
~   vpc-native-private-deployment                   kubernetes:apps/v1:Deployment  update
~   vpc-native-clean-zombie-images-cron             kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-zombie-users-cron              kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-stale-user-transactions-cron   kubernetes:batch/v1:CronJob    update
~   vpc-native-personalized-digest-deployment       kubernetes:apps/v1:Deployment  update
~   vpc-native-bg-deployment                        kubernetes:apps/v1:Deployment  update
~   vpc-native-validate-active-users-cron           kubernetes:batch/v1:CronJob    update
~   vpc-native-update-source-tag-view-cron          kubernetes:batch/v1:CronJob    update
~   vpc-native-daily-digest-cron                    kubernetes:batch/v1:CronJob    update
-   vpc-native-api-migration-39fd11d5               kubernetes:batch/v1:Job        delete
~   vpc-native-ws-deployment                        kubernetes:apps/v1:Deployment  update
~   vpc-native-clean-gifted-plus-cron               kubernetes:batch/v1:CronJob    update
+   vpc-native-api-migration-46b91bf4               kubernetes:batch/v1:Job        create
~   vpc-native-clean-zombie-user-companies-cron     kubernetes:batch/v1:CronJob    update
~   vpc-native-generate-search-invites-cron         kubernetes:batch/v1:CronJob    update
~   vpc-native-update-current-streak-cron           kubernetes:batch/v1:CronJob    update
~   vpc-native-generic-referral-reminder-cron       kubernetes:batch/v1:CronJob    update
~   vpc-native-hourly-notification-cron             kubernetes:batch/v1:CronJob    update
~   vpc-native-calculate-top-readers-cron           kubernetes:batch/v1:CronJob    update
~   vpc-native-deployment                           kubernetes:apps/v1:Deployment  update
~   vpc-native-temporal-deployment                  kubernetes:apps/v1:Deployment  update
~   vpc-native-check-analytics-report-cron          kubernetes:batch/v1:CronJob    update
~   vpc-native-update-tag-recommendations-cron      kubernetes:batch/v1:CronJob    update
~   vpc-native-update-tags-str-cron                 kubernetes:batch/v1:CronJob    update
~   vpc-native-update-views-cron                    kubernetes:batch/v1:CronJob    update

@sshanzel sshanzel changed the title Mi 961 reach feat: daily estimated reach Jul 29, 2025
@sshanzel
Copy link
Contributor Author

As promised, I also removed the typescript magic we had before: 6f7fe38

};

if (budget && durationInDays) {
params.duration = durationInDays * ONE_DAY_IN_SECONDS;
Copy link
Contributor

Choose a reason for hiding this comment

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

why not just accepts seconds on API and just say duration, then we can calculate how ever we want?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it is better to keep it in days; most of the mutations understand that we need to send the amount in days, then we do the calculation here, so we will only do the conversion once.

Copy link
Contributor

@capJavert capJavert Jul 29, 2025

Choose a reason for hiding this comment

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

yeah but see how skadi accepts seconds, it is much more future proof

if you want to proceed with days, ok, but let's make the separate method for estimatePostBoostReachDaily as you did for mutation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, we can do that.

Copy link
Contributor

@capJavert capJavert Jul 29, 2025

Choose a reason for hiding this comment

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

it can even call base method which would accept duration in seconds (to dedupe the logic for fetch)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Let me add that.

Copy link
Contributor

@capJavert capJavert left a comment

Choose a reason for hiding this comment

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

Just some sanity checks, thanks for taking care of camel case helper and proper tests, awesome effort!

@sshanzel sshanzel requested a review from capJavert July 29, 2025 13:45
@sshanzel sshanzel merged commit d5d327a into main Jul 30, 2025
9 checks passed
@sshanzel sshanzel deleted the MI-961-reach branch July 30, 2025 10:14
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