ish_models 0.0.33.228 → 0.0.33.230
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/iro/option_watch.rb +3 -1
- data/lib/ish/email_context.rb +7 -3
- data/lib/office/scheduled_email_action.rb +27 -0
- data/lib/report.rb +1 -11
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b6e8cdb5d6318f3571949e0b6bd148bf3bfba895c0f7c53f2744caf060876e0
|
4
|
+
data.tar.gz: 4c8ff28513a7c4deb978a39ac728729b6b5a10a43ea2e7e13553905655bdf423
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f6c720885cd4e0b322ee54862fefba63a9d7af7e993c455dd942ec0b1f8aabfcbd9599362e5887bb0e325fd18cfad0c47f193ee7db8f31f7a5f1dae98ba6afd
|
7
|
+
data.tar.gz: 3e906a2d06e5b4ba91f7cf194cec788c8161d36930bab21fc516a6a47a100e142011ab6609f2fefbd1d17ffdfaa388845793e28ebee3b88e67af8131dd096e1b
|
data/lib/iro/option_watch.rb
CHANGED
data/lib/ish/email_context.rb
CHANGED
@@ -49,14 +49,18 @@ class ::Ish::EmailContext
|
|
49
49
|
field :send_at, type: DateTime
|
50
50
|
|
51
51
|
|
52
|
-
def
|
53
|
-
|
52
|
+
def notsent
|
53
|
+
Ish::EmailContext.where( sent_at: nil )
|
54
|
+
end
|
55
|
+
def self.notsent; new.notsent; end
|
56
|
+
|
54
57
|
|
55
|
-
def self.scheduled; new.scheduled; end
|
56
58
|
def scheduled
|
57
59
|
# or({ :send_at.lte => Time.now }, { :send_at => nil }) ## This won't work b/c I need draft state!
|
58
60
|
Ish::EmailContext.where({ :send_at.lte => Time.now })
|
59
61
|
end
|
62
|
+
def self.scheduled; new.scheduled; end
|
63
|
+
|
60
64
|
|
61
65
|
def self.from_email_list
|
62
66
|
Ish::EmailCampaign.from_email_list
|
@@ -28,6 +28,33 @@ class Office::ScheduledEmailAction
|
|
28
28
|
|
29
29
|
field :perform_at, type: :time
|
30
30
|
|
31
|
+
def send_and_roll
|
32
|
+
sch = self
|
33
|
+
sch.update_attributes({ state: Sch::STATE_INACTIVE })
|
34
|
+
|
35
|
+
# send now
|
36
|
+
ctx = Ctx.create!({
|
37
|
+
email_template_id: sch.act.tmpl.id,
|
38
|
+
lead_id: sch.lead.id,
|
39
|
+
send_at: Time.now,
|
40
|
+
subject: sch.act.tmpl.subject,
|
41
|
+
from_email: sch.act.tmpl.from_email,
|
42
|
+
scheduled_email_action_id: sch.act.id,
|
43
|
+
})
|
44
|
+
|
45
|
+
# schedule next actions & update the action
|
46
|
+
sch.act.ties.each do |tie|
|
47
|
+
next_act = tie.next_email_action
|
48
|
+
next_at = eval(tie.next_at_exe)
|
49
|
+
next_sch = Sch.find_or_initialize_by({
|
50
|
+
lead_id: sch.lead_id,
|
51
|
+
email_action_id: next_act.id,
|
52
|
+
})
|
53
|
+
next_sch.perform_at = next_at
|
54
|
+
next_sch.state = Sch::STATE_ACTIVE
|
55
|
+
next_sch.save!
|
56
|
+
end
|
57
|
+
end
|
31
58
|
|
32
59
|
end
|
33
60
|
::Sch = Office::ScheduledEmailAction
|
data/lib/report.rb
CHANGED
@@ -27,9 +27,7 @@ class Report
|
|
27
27
|
|
28
28
|
field :is_public, :type => Boolean, :default => true
|
29
29
|
index({ :is_public => 1 })
|
30
|
-
scope :public, ->{
|
31
|
-
where({ is_public: true })
|
32
|
-
}
|
30
|
+
scope :public, ->{ where({ is_public: true }) }
|
33
31
|
|
34
32
|
field :is_feature, :type => Boolean, :default => false
|
35
33
|
index({ :is_feature => 1 })
|
@@ -58,10 +56,6 @@ class Report
|
|
58
56
|
field :n_upvotes, :default => 0
|
59
57
|
field :n_spamvotes, :default => 0
|
60
58
|
|
61
|
-
default_scope ->{
|
62
|
-
where({ is_public: true, is_trash: false }).order_by({ created_at: :desc })
|
63
|
-
}
|
64
|
-
|
65
59
|
has_many :newsitems
|
66
60
|
|
67
61
|
def self.list conditions = { :is_trash => false }
|
@@ -74,10 +68,6 @@ class Report
|
|
74
68
|
self::PER_PAGE
|
75
69
|
end
|
76
70
|
|
77
|
-
def self.all
|
78
|
-
self.where( :is_public => true, :is_trash => false ).order_by( :created_at => :desc )
|
79
|
-
end
|
80
|
-
|
81
71
|
def self.clear
|
82
72
|
if Rails.env.test?
|
83
73
|
self.unscoped.each { |r| r.remove }
|