Overview
Display a sparkline chart on each campaign card (similar to GitHub's repository activity graph) showing pledged amount growth over time.
Motivation
A time-series funding chart gives users instant visual signal of a campaign's momentum — is it accelerating, stagnating, or surging in the final days?
Required Changes
Backend
-
New campaign_snapshots table
- Fields:
campaign_pid, pledged_amount, backers_count, recorded_at
- Unique constraint on
(campaign_pid, DATE(recorded_at)) — one snapshot per day
-
Cron hook — after each nightly crawl, upsert a snapshot for every discovered campaign
-
New API endpoint
GET /api/campaigns/:pid/history
Returns ordered array of { recorded_at, pledged_amount, backers_count }
iOS
- Add
CampaignSnapshot model and fetchHistory(pid:) in APIClient
- Render sparkline using Swift Charts (built-in, iOS 16+, no extra dependency) on each campaign card
chartXAxis(.hidden) + chartYAxis(.hidden) for compact inline display
Constraints
- Sparkline requires ≥ 3 data points to be meaningful; show a static progress bar (percent_funded) as fallback until enough history is collected
- One snapshot per campaign per day — do not store duplicates within the same calendar day
Overview
Display a sparkline chart on each campaign card (similar to GitHub's repository activity graph) showing pledged amount growth over time.
Motivation
A time-series funding chart gives users instant visual signal of a campaign's momentum — is it accelerating, stagnating, or surging in the final days?
Required Changes
Backend
New
campaign_snapshotstablecampaign_pid,pledged_amount,backers_count,recorded_at(campaign_pid, DATE(recorded_at))— one snapshot per dayCron hook — after each nightly crawl, upsert a snapshot for every discovered campaign
New API endpoint
Returns ordered array of
{ recorded_at, pledged_amount, backers_count }iOS
CampaignSnapshotmodel andfetchHistory(pid:)inAPIClientchartXAxis(.hidden)+chartYAxis(.hidden)for compact inline displayConstraints