Skip to content
rymai edited this page Feb 3, 2012 · 14 revisions

Newsletter Deals

Idea

The link in the newsletter could direct to http://sublimevideo.net/d/rts1/12345 d is for deal, rts1 is the token of the deal, 12345 is the id of the user who clicked the deal link.

Visiting such URL would:

New models

Deal

  • name: Real-Time Stats promotion #1
  • description: 20% discount on the Yearly plans
  • token: rts1
  • type: yearly_plans_discount (other possible value is plans_discount)
  • value: 0.2 => 20% (can be nil because maybe it'd not be applicable for all deals)
  • started_at/ended_at

In Plan, the #discounted?(site) method should:

  • take the list of current available deals, sorted by date DESC (the latest first)
  • loop through this list and take the first deal that the site's user has activated
  • if there's a deal and its type match with the tested plan, return the deal, otherwise continue the loop
  • return false by default

In Plan, the #discounted_percentage(site) method should:

  • return 0 if #discounted?(site) is false
  • return the deal's value

In Plan, the #price(site) method should:

  • return price * #discounted_percentage(site)

UserDeals (not final, still under heavy thinking...)

Keeps track of which deals a user has activated.

Collection: user_deals

  • user_id
  • deals: ['rts1'] => array of activated deal
  • created_at

Deal::Stats (not final, still under heavy thinking...)

Store stats about activated deals every day.

Collection: deals_stats

  • d => Day
  • activated: { 'rts1' => 1000 }