-
Notifications
You must be signed in to change notification settings - Fork 0
Newsletter Deals
rymai edited this page Feb 6, 2012
·
14 revisions
The link in the newsletter will direct to https://my.sublimevideo.net/deals/rts1
-
deals
is fordeal
-
rts1
is the token of the deal.
Note: The user has to be logged-in to activate a deal.
Visiting such URL would:
- create/update a record in the
deal_activations
table (see below for details), - redirect to https://my.sublimevideo.net/sites
- shows a sticky notice to inform the user that the deal is currently available
-
name
:Real-Time Stats promotion #1
-
description
:20% discount on the Yearly plans
-
token
:rts1
-
type
:yearly_plans_discount
(other possible value ismonthly_plans_discount
andplans_discount
) -
value
:0.2
=> 20% (can be nil because maybe it'd not be applicable for all deals) -
available_to
:subscribed_to_newsletter
=> A scope that defines which users have access to the deal -
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)
Table: deal_activations
Keeps track of which deals a user has activated.
deal_id
user_id
activated_at
Table: deal_utilizations
Keeps track of which deals a user has used.
deal_id
site_id
invoice_id
used_at
Store stats about activated deals every day.
Collection: deals_stats
-
d
=> Day -
activated
:{ 'rts1' => 1000 }
-
used
:{ 'rts1' => 200 }