Skip to main content

Purpose

Calculates how many boosted pages to create today to hit the weekly target of 100 pages. Handles product rotation when there are more products than the weekly product allocation.

Architecture

Weekly Target Distribution

EntityWeekly TargetNotes
Business50 pages50% of 100
Products50 pages totalSplit across selected products
If no products exist, business gets all 100 pages.

Round-Robin Product Selection

When there are more than 50 products:
  1. Select 50 products per week using rotation
  2. Week number determines which 50 are selected
  3. All products eventually get coverage

Response Format

{
  "org_slug": "org-slug-123",
  "week_start": "2024-01-15",
  "week_end": "2024-01-21",
  "week_number": 3,
  "days_remaining": 4,
  "weekly_target": 100,
  "total_products": 75,
  "products_selected_this_week": 50,
  "business": {
    "daily_quota": 8,
    "this_week": 18,
    "target": 50,
    "remaining": 32
  },
  "products": [
    {
      "name": "Product A",
      "daily_quota": 1,
      "this_week": 0,
      "target": 1,
      "remaining": 1
    }
  ],
  "total_daily_quota": 25,
  "round_robin_note": "Rotating through 75 products, 50 selected this week"
}

Daily Quota Formula

daily_quota = ceil(remaining / days_remaining)

Code Location

src/app/apis/cron/boosted_pages_quota/routes.py