MCPcopy Create free account
hub / github.com/dailydotdev/apps / lastBoostOf

Function lastBoostOf

packages/shared/src/features/boost/common.ts:33–51  ·  view source on GitHub ↗
(campaign: Campaign)

Source from the content-addressed store, hash-verified

31/** A completed boost's daily budget and days. A stopped one ended early, so
32 * its days no longer tell what it was set to */
33export const lastBoostOf = (campaign: Campaign): LastBoost | undefined => {
34 if (campaign.state !== CampaignState.Completed || !campaign.flags?.budget) {
35 return undefined;
36 }
37
38 const totalDays = Math.max(
39 1,
40 Math.round(
41 (new Date(campaign.endedAt).getTime() -
42 new Date(campaign.createdAt).getTime()) /
43 oneDay,
44 ),
45 );
46
47 return {
48 totalDays,
49 coresPerDay: Math.round(campaign.flags.budget / totalDays),
50 };
51};

Callers 3

onBoostAgainFunction · 0.90
openCampaignFunction · 0.90
onBoostClickFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected