ish_manager 0.1.8.403 → 0.1.8.404
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/ish_manager/application_helper.rb +6 -4
- data/app/mailers/ish_manager/application_mailer.rb +2 -2
- data/app/mailers/ish_manager/office_mailer.rb +2 -16
- data/app/views/ish_manager/application/_debug.haml +1 -0
- data/app/views/ish_manager/email_contexts/index.haml +3 -1
- data/lib/tasks/office_tasks.rake +5 -32
- data/lib/tasks-done/migrate.rake +20 -0
- metadata +2 -3
- data/lib/tasks/ish_manager_tasks.rake +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b0e695973583101608da564e5460f74838147a078b52a29cab8c1aab34e9534
|
4
|
+
data.tar.gz: 16a23aa8e36df3e4ecee24a754516026017e40b9cc3f45e7a6b5cc81862d02e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cca17f65defbd1073a29f7fc5a6269864651083aaf6fdf1b5b2aeb63b432cb08e347d4e60c6b374405d25a4fae98414434fafc3490ca242e18e1b22740dd4e5
|
7
|
+
data.tar.gz: 2ca8c6173c2317cd453fef7b4c6057db8f0858d1b2b9ffa315e3aa5b86a00eea6c5ce5f0714ca05bc414b618a5483874e95386aaadfb7b5e19c528b4424edaff
|
@@ -30,10 +30,6 @@ module IshManager
|
|
30
30
|
# "/manager/email_contexts/for_lead/#{lead.id.to_s}"
|
31
31
|
# end
|
32
32
|
|
33
|
-
def pretty_date input
|
34
|
-
return input.strftime("%Y-%m-%d")
|
35
|
-
end
|
36
|
-
|
37
33
|
def pp_errors errors
|
38
34
|
return errors
|
39
35
|
end
|
@@ -53,6 +49,12 @@ module IshManager
|
|
53
49
|
date&.strftime('%Y-%m-%d')
|
54
50
|
end
|
55
51
|
def pp_date a; pretty_date a; end
|
52
|
+
def pp_datetime date
|
53
|
+
date&.strftime('%Y-%m-%d %l:%M%P %z')
|
54
|
+
end
|
55
|
+
def pp_time date
|
56
|
+
date&.strftime('%l:%M%P %z')
|
57
|
+
end
|
56
58
|
|
57
59
|
def pp_amount a
|
58
60
|
return '-' if !a
|
@@ -12,7 +12,7 @@ module IshManager
|
|
12
12
|
@gallery_path = IshManager::Engine.routes.url_helpers.gallery_path(@gallery.slug)
|
13
13
|
mail( :to => '314658@gmail.com',
|
14
14
|
:bcc => profiles.map { |p| p.email },
|
15
|
-
:subject => 'You got new shared galleries on pi manager' )
|
15
|
+
:subject => 'You got new shared galleries on pi manager' )
|
16
16
|
end
|
17
17
|
|
18
18
|
def option_alert option
|
@@ -32,7 +32,7 @@ module IshManager
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def test_email
|
35
|
-
mail( to:
|
35
|
+
mail( to: DEFAULT_RECIPIENT, subject: "Test email at #{Time.now}" )
|
36
36
|
end
|
37
37
|
|
38
38
|
end
|
@@ -54,8 +54,9 @@ class IshManager::OfficeMailer < IshManager::ApplicationMailer
|
|
54
54
|
template_name: template )
|
55
55
|
end
|
56
56
|
|
57
|
+
## 2023-04-02 _vp_ Continue.
|
57
58
|
def send_context_email ctx_id
|
58
|
-
@ctx =
|
59
|
+
@ctx = Ctx.find ctx_id
|
59
60
|
ac = ActionController::Base.new
|
60
61
|
ac.instance_variable_set( :@ctx, @ctx )
|
61
62
|
|
@@ -69,18 +70,3 @@ class IshManager::OfficeMailer < IshManager::ApplicationMailer
|
|
69
70
|
end
|
70
71
|
|
71
72
|
end
|
72
|
-
|
73
|
-
|
74
|
-
## 2022-11-10 _vp_ backup
|
75
|
-
# def send_context_email ctx_id
|
76
|
-
# @email_ctx = ::Ish::EmailContext.find ctx_id
|
77
|
-
# template = "render/_#{@email_ctx.email_template.slug}"
|
78
|
-
# ac = ActionController::Base.new
|
79
|
-
# ac.instance_variable_set( :@email_ctx, @email_ctx )
|
80
|
-
# rendered_str = ac.render_to_string("ish_manager/email_templates/_#{@email_ctx.email_template.slug}")
|
81
|
-
# @email_ctx.update( rendered_str: rendered_str, sent_at: Time.now )
|
82
|
-
# mail( to: @email_ctx.to_email,
|
83
|
-
# bcc: 'piousbox@gmail.com',
|
84
|
-
# subject: @email_ctx.subject,
|
85
|
-
# template_name: template )
|
86
|
-
# end
|
@@ -44,7 +44,9 @@
|
|
44
44
|
= link_to email_context_path(ctx) do
|
45
45
|
= ctx.subject ? ctx.subject : "t| #{ctx.tmpl.subject}"
|
46
46
|
%td= ctx.email_template.slug
|
47
|
-
%td
|
47
|
+
%td.send_at
|
48
|
+
.a= pp_date ctx.send_at
|
49
|
+
.a= pp_time ctx.send_at
|
48
50
|
%td= pp_date ctx.sent_at
|
49
51
|
|
50
52
|
|
data/lib/tasks/office_tasks.rake
CHANGED
@@ -1,9 +1,4 @@
|
|
1
1
|
|
2
|
-
def puts! a, b=''
|
3
|
-
puts "+++ +++ #{b}"
|
4
|
-
puts a.inspect
|
5
|
-
end
|
6
|
-
|
7
2
|
namespace :office do
|
8
3
|
|
9
4
|
desc 'scheduled email actions, rolling perform'
|
@@ -11,34 +6,10 @@ namespace :office do
|
|
11
6
|
while true do
|
12
7
|
|
13
8
|
Sch.active.where({ :perform_at.lte => Time.now }).each do |sch|
|
14
|
-
sch.update_attributes({ state: Sch::STATE_INACTIVE })
|
15
9
|
|
16
|
-
|
17
|
-
ctx = Ctx.new({
|
18
|
-
email_template_id: sch.act.tmpl.id,
|
19
|
-
lead_id: sch.lead.id,
|
20
|
-
send_at: Time.now,
|
21
|
-
subject: sch.act.tmpl.subject,
|
22
|
-
from_email: sch.act.tmpl.from_email,
|
23
|
-
scheduled_email_action_id: sch.act.id,
|
24
|
-
})
|
25
|
-
ctx.save!
|
26
|
-
|
27
|
-
# schedule next actions & update the action
|
28
|
-
sch.act.ties.each do |tie|
|
29
|
-
next_act = tie.next_email_action
|
30
|
-
next_at = eval(tie.next_at_exe)
|
31
|
-
next_sch = Sch.find_or_initialize_by({
|
32
|
-
lead_id: sch.lead_id,
|
33
|
-
email_action_id: next_act.id,
|
34
|
-
})
|
35
|
-
next_sch.perform_at = next_at
|
36
|
-
next_sch.state = Sch::STATE_ACTIVE
|
37
|
-
next_sch.save!
|
38
|
-
end
|
10
|
+
sch.send_and_roll
|
39
11
|
|
40
12
|
print '+'
|
41
|
-
|
42
13
|
end
|
43
14
|
|
44
15
|
# sleep 1.minute
|
@@ -47,13 +18,15 @@ namespace :office do
|
|
47
18
|
end
|
48
19
|
end
|
49
20
|
|
21
|
+
## 2023-04-02 _vp_ Continue.
|
50
22
|
desc "send emails"
|
51
|
-
task
|
23
|
+
task ctxs: :environment do
|
52
24
|
while true do
|
53
25
|
|
54
26
|
ctxs = ::Ish::EmailContext.scheduled.notsent
|
55
27
|
ctxs.map do |ctx|
|
56
|
-
IshManager::OfficeMailer.send_context_email( ctx[:id].to_s )
|
28
|
+
out = IshManager::OfficeMailer.send_context_email( ctx[:id].to_s )
|
29
|
+
Rails.env.production? ? out.deliver_later : out.deliver_now
|
57
30
|
print '^'
|
58
31
|
end
|
59
32
|
|
data/lib/tasks-done/migrate.rake
CHANGED
@@ -30,5 +30,25 @@ namespace :migrate do
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
desc "every user needs a user_profile"
|
34
|
+
task :generate_user_profiles => :environment do
|
35
|
+
User.all.map do |u|
|
36
|
+
unless u.profile
|
37
|
+
p = ::Ish::UserProfile.new :email => u.email, :user => u, :role_name => :guy
|
38
|
+
u.profile = p
|
39
|
+
u.save && p.save && print('.')
|
40
|
+
end
|
41
|
+
end
|
42
|
+
puts 'OK'
|
43
|
+
end
|
44
|
+
|
45
|
+
desc 'assign my creator_profile to Gameui::Marker where missing'
|
46
|
+
task :gameui_markers_creator_profile => :environment do
|
47
|
+
ms = Gameui::Marker.where( creator_profile_id: nil )
|
48
|
+
profile = User.find_by( email: 'piousbox@gmail.com' ).profile
|
49
|
+
ms.update_all( creator_profile_id: profile.id )
|
50
|
+
end
|
51
|
+
|
52
|
+
|
33
53
|
end
|
34
54
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ish_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.8.
|
4
|
+
version: 0.1.8.404
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -598,7 +598,6 @@ files:
|
|
598
598
|
- lib/systemd/system/stockwatcher.service
|
599
599
|
- lib/systemd/system/watch_stocks.service
|
600
600
|
- lib/tasks-done/migrate.rake
|
601
|
-
- lib/tasks/ish_manager_tasks.rake
|
602
601
|
- lib/tasks/office_tasks.rake
|
603
602
|
homepage: http://wasya.co
|
604
603
|
licenses:
|
@@ -1,29 +0,0 @@
|
|
1
|
-
|
2
|
-
def puts! a, b=''
|
3
|
-
puts "+++ +++ #{b}"
|
4
|
-
puts a.inspect
|
5
|
-
end
|
6
|
-
|
7
|
-
namespace :ish_manager do
|
8
|
-
|
9
|
-
desc "every user needs a user_profile"
|
10
|
-
task :generate_user_profiles => :environment do
|
11
|
-
User.all.map do |u|
|
12
|
-
unless u.profile
|
13
|
-
p = ::Ish::UserProfile.new :email => u.email, :user => u, :role_name => :guy
|
14
|
-
u.profile = p
|
15
|
-
u.save && p.save && print('.')
|
16
|
-
end
|
17
|
-
end
|
18
|
-
puts 'OK'
|
19
|
-
end
|
20
|
-
|
21
|
-
desc 'assign my creator_profile to Gameui::Marker where missing'
|
22
|
-
task :gameui_markers_creator_profile => :environment do
|
23
|
-
ms = Gameui::Marker.where( creator_profile_id: nil )
|
24
|
-
profile = User.find_by( email: 'piousbox@gmail.com' ).profile
|
25
|
-
ms.update_all( creator_profile_id: profile.id )
|
26
|
-
end
|
27
|
-
|
28
|
-
|
29
|
-
end
|