wco_models 3.1.0.83 → 3.1.0.85
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/wco/headline.rb +2 -1
- data/app/models/wco/office_action.rb +17 -1
- data/app/models/wco/office_action_template_tie.rb +2 -2
- data/app/views/wco/office_action_templates/_ties.haml +6 -6
- data/app/views/wco/office_actions/_index.haml +2 -0
- data/lib/tasks/office_tasks.rake +11 -19
- 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: e35d2da6576585f442b86b8ab7589e6338a8c621659f1cb3fbc9f83135c9803e
|
4
|
+
data.tar.gz: 2640b0995ab53af533155910cd90d607188754e87e6d58898eed2a1a3c98354e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f55ff4f412e168ba9a2e715afd3e90abd8e44f5d209f544beec59e0d1e9125be0fe1e25763b62e14b131e9c986fb633594d974cedda643ceb8601c74f4b2c18
|
7
|
+
data.tar.gz: ee4b6abe4d93e40dabd416046b23fce7fea9a2596283fdcce523419eb33941c83855799b8201b32be22c21c554aed0212a50033ee45be56d91da197c8685c8aa
|
data/app/models/wco/headline.rb
CHANGED
@@ -12,7 +12,8 @@ class Wco::Headline
|
|
12
12
|
field :name
|
13
13
|
validates :name, presence: true, uniqueness: true
|
14
14
|
|
15
|
-
|
15
|
+
## @TODO: remove this entirely. 2024-01-16
|
16
|
+
belongs_to :site, class_name: 'Wco::Site', optional: true
|
16
17
|
|
17
18
|
has_and_belongs_to_many :tags, class_name: 'Wco::Tag'
|
18
19
|
|
@@ -23,9 +23,25 @@ class Wco::OfficeAction
|
|
23
23
|
|
24
24
|
field :perform_at, type: :time
|
25
25
|
|
26
|
+
def do_run
|
27
|
+
sch = self
|
28
|
+
sch.update!({ status: STATUS_INACTIVE })
|
29
|
+
|
30
|
+
eval( sch.tmpl.action_exe )
|
31
|
+
|
32
|
+
# schedule next actions & update the action
|
33
|
+
sch.tmpl.ties.each do |tie|
|
34
|
+
next_sch = self.class.find_or_initialize_by({
|
35
|
+
office_action_template_id: tie.next_tmpl.id,
|
36
|
+
})
|
37
|
+
next_sch.perform_at = eval(tie.next_at_exe)
|
38
|
+
next_sch.status = STATUS_ACTIVE
|
39
|
+
next_sch.save!
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
26
43
|
def to_s
|
27
44
|
slug
|
28
45
|
end
|
29
|
-
|
30
46
|
end
|
31
47
|
|
@@ -7,10 +7,10 @@ class Wco::OfficeActionTemplateTie
|
|
7
7
|
attr_accessor :to_delete
|
8
8
|
|
9
9
|
belongs_to :office_action_template, class_name: 'OfficeActionTemplate', inverse_of: :ties
|
10
|
-
def
|
10
|
+
def tmpl; office_action_template; end
|
11
11
|
|
12
12
|
belongs_to :next_office_action_template, class_name: 'OfficeActionTemplate', inverse_of: :prev_ties
|
13
|
-
def
|
13
|
+
def next_tmpl; next_office_action_template; end
|
14
14
|
# def tmpl; next_office_action_template; end
|
15
15
|
|
16
16
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
-
|
2
|
+
- tmpl ||= nil
|
3
3
|
- depth ||= 5
|
4
4
|
- depth = depth - 1
|
5
5
|
|
@@ -10,9 +10,9 @@
|
|
10
10
|
%li
|
11
11
|
= tie.next_at_exe
|
12
12
|
%br
|
13
|
-
= link_to '[~]', edit_office_action_template_path(tie.
|
14
|
-
= link_to tie.
|
15
|
-
- if tie.
|
13
|
+
= link_to '[~]', edit_office_action_template_path(tie.next_tmpl)
|
14
|
+
= link_to tie.next_tmpl, office_action_template_path(tie.next_tmpl)
|
15
|
+
- if tie.next_tmpl == tmpl
|
16
16
|
<b>[Same]</b>
|
17
|
-
- elsif tie.
|
18
|
-
= render '/wco/office_action_templates/ties', ties: tie.
|
17
|
+
- elsif tie.next_tmpl.ties.present?
|
18
|
+
= render '/wco/office_action_templates/ties', ties: tie.next_tmpl.ties, depth: depth, tmpl: tie.next_tmpl
|
data/lib/tasks/office_tasks.rake
CHANGED
@@ -2,34 +2,26 @@
|
|
2
2
|
require 'business_time'
|
3
3
|
require 'httparty'
|
4
4
|
|
5
|
-
namespace :
|
5
|
+
namespace :wco do
|
6
6
|
|
7
|
-
|
7
|
+
|
8
|
+
desc 'run office actions'
|
8
9
|
task run_office_actions: :environment do
|
10
|
+
puts! "Starting wco_email:run_office_actions..."
|
9
11
|
while true do
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
OA.active.where( :perform_at.lte => Time.now ).each do |oa|
|
15
|
-
puts "+++ +++ Office Action: #{oa}"
|
13
|
+
schs = Wco::OfficeAction.active.where({ :perform_at.lte => Time.now })
|
14
|
+
print "[#{schs.length}]" if schs.length != 0
|
15
|
+
schs.each do |sch|
|
16
16
|
|
17
|
-
|
18
|
-
oa.tmpl.do_run
|
19
|
-
oa.tmpl.ties.each do |tie|
|
20
|
-
next_oa = OA.find_or_initialize_by({
|
21
|
-
office_action_template_id: tie.next_oat.id,
|
22
|
-
})
|
23
|
-
next_oa.perform_at = eval( tie.next_at_exe )
|
24
|
-
next_oa.status = ACTIVE
|
25
|
-
next_oa.save!
|
26
|
-
end
|
17
|
+
sch.do_run
|
27
18
|
|
28
|
-
print
|
19
|
+
print "[#{sch.id}]^"
|
20
|
+
sleep 15
|
29
21
|
end
|
30
22
|
|
31
23
|
print '.'
|
32
|
-
sleep
|
24
|
+
sleep 15
|
33
25
|
end
|
34
26
|
end
|
35
27
|
|