referthis 0.4.7 → 0.4.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/referral.rb +6 -4
- metadata +2 -2
data/lib/referral.rb
CHANGED
@@ -41,6 +41,7 @@ class Referral < ActiveRecord::Base
|
|
41
41
|
threads.each {|thread| thread.join}
|
42
42
|
end
|
43
43
|
def self.clicked_through_rate(email=false, sms=false, overall=true)
|
44
|
+
clicked_through_rates = []
|
44
45
|
if email || sms
|
45
46
|
referrals = Referral.all
|
46
47
|
if referrals.any?
|
@@ -62,13 +63,14 @@ class Referral < ActiveRecord::Base
|
|
62
63
|
end
|
63
64
|
end
|
64
65
|
end
|
65
|
-
|
66
|
-
|
66
|
+
clicked_through_rate['email'] = ((clicked_through_email.to_f / count_email.to_f) * 100).to_s + '%' if email
|
67
|
+
clicked_through_rate['sms'] = ((clicked_through_sms.to_f / count_sms.to_f) * 100).to_s + '%' if sms
|
67
68
|
else
|
68
|
-
|
69
|
+
return '0%'
|
69
70
|
end
|
70
71
|
end
|
71
|
-
|
72
|
+
clicked_through_rate['overall'] = ((Referral.where('visits > 0').count.to_f / Referral.count.to_f) * 100).to_s + '%' if overall
|
73
|
+
return clicked_through_rate
|
72
74
|
end
|
73
75
|
def self.resolve_token(token)
|
74
76
|
referral_id = Base64::decode64(token)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: referthis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: active_record
|