think_feel_do_engine 3.20.1 → 3.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/think_feel_do_engine/coach/group_dashboard_controller.rb +1 -1
- data/app/controllers/think_feel_do_engine/participants/passwords_controller.rb +1 -1
- data/app/controllers/think_feel_do_engine/users/registrations_controller.rb +1 -1
- data/app/helpers/think_feel_do_engine/activities_helper.rb +1 -1
- data/app/helpers/think_feel_do_engine/brand_helper.rb +1 -1
- data/app/helpers/think_feel_do_engine/presenters_helper.rb +1 -1
- data/app/models/available_content_module.rb +8 -8
- data/app/models/content_providers/module_index_provider.rb +3 -3
- data/app/models/membership.rb +3 -3
- data/app/models/participant.rb +1 -1
- data/app/models/task.rb +8 -12
- data/app/models/task_status.rb +6 -1
- data/app/models/think_feel_do_engine/reports/messaging.rb +3 -3
- data/app/models/think_feel_do_engine/reports/module_session.rb +3 -3
- data/app/models/think_feel_do_engine/reports/patient_activity.rb +1 -1
- data/app/models/tool_nav_item.rb +6 -6
- data/app/models/values/accomplishment.rb +1 -1
- data/app/models/values/emotional_rating.rb +1 -1
- data/app/models/values/mood.rb +1 -1
- data/app/views/think_feel_do_engine/participants/content_modules/index.html.erb +1 -1
- data/app/views/think_feel_do_engine/shared/participant/_hamburger_nav_items.html.erb +1 -1
- data/app/views/think_feel_do_engine/shared/participant/_nav_items.html.erb +3 -3
- data/db/migrate/20160616162347_convert_slide_options.rb +11 -0
- data/db/migrate/20160616201120_convert_event_payloads.rb +23 -0
- data/lib/tasks/lesson_notifications.rake +1 -1
- data/lib/think_feel_do_engine/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3bcad632eb10037be393711c01e5b9c62f00081
|
4
|
+
data.tar.gz: dd748908ba0ebf80bc86c672b08674b2cf102445
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a85a6b07d8f54f14325bdfe0e27a39f56bb7fd27f38246136eef69237cb7b94c706f14215332ac280a55290d6bffb43684f46800be6cfb6ba8b25102c7e44bc
|
7
|
+
data.tar.gz: 3d34f12e972f003b2a80dc845235fd1356cd92d235a925fa3bce3783081122e4cc1267b68bea2905d8a8c2f7560958b92941925d59227361a6cead68e16a648b
|
@@ -22,7 +22,7 @@ module ThinkFeelDoEngine
|
|
22
22
|
|
23
23
|
def create
|
24
24
|
@participant = Participant.find_by(email: resource_params[:email])
|
25
|
-
if @participant.try(:
|
25
|
+
if @participant.try(:not_allowed_in_site?)
|
26
26
|
msg = "New password cannot be sent; this account is not active."
|
27
27
|
redirect_to new_participant_session_path, alert: msg
|
28
28
|
else
|
@@ -18,27 +18,27 @@ class AvailableContentModule < ActiveRecord::Base
|
|
18
18
|
where bit_core_tool_id: tool.id
|
19
19
|
end
|
20
20
|
|
21
|
-
def self.
|
21
|
+
def self.visualization
|
22
22
|
where is_viz: true
|
23
23
|
end
|
24
24
|
|
25
|
-
def self.
|
25
|
+
def self.non_visualization
|
26
26
|
where is_viz: false
|
27
27
|
end
|
28
28
|
|
29
|
-
def self.
|
29
|
+
def self.completed
|
30
30
|
where.not completed_at: nil
|
31
31
|
end
|
32
32
|
|
33
|
-
def self.
|
33
|
+
def self.not_completed
|
34
34
|
where completed_at: nil
|
35
35
|
end
|
36
36
|
|
37
|
-
def self.
|
37
|
+
def self.didactic
|
38
38
|
where has_didactic_content: true
|
39
39
|
end
|
40
40
|
|
41
|
-
def self.
|
41
|
+
def self.not_didactic
|
42
42
|
where has_didactic_content: false
|
43
43
|
end
|
44
44
|
|
@@ -58,7 +58,7 @@ class AvailableContentModule < ActiveRecord::Base
|
|
58
58
|
)
|
59
59
|
end
|
60
60
|
|
61
|
-
def self.
|
61
|
+
def self.terminated_on(date)
|
62
62
|
where(arel_table[:terminates_on].lt(date))
|
63
63
|
end
|
64
64
|
|
@@ -70,7 +70,7 @@ class AvailableContentModule < ActiveRecord::Base
|
|
70
70
|
)
|
71
71
|
end
|
72
72
|
|
73
|
-
def self.
|
73
|
+
def self.not_terminated_on(date)
|
74
74
|
where(arel_table[:terminates_on].eq(nil)
|
75
75
|
.or(arel_table[:terminates_on].gteq(date)))
|
76
76
|
end
|
@@ -11,8 +11,8 @@ module ContentProviders
|
|
11
11
|
locals: {
|
12
12
|
participant: participant,
|
13
13
|
content_modules: content_modules,
|
14
|
-
didactic_modules: content_modules.
|
15
|
-
non_didactic_modules: content_modules.
|
14
|
+
didactic_modules: content_modules.non_visualization.didactic,
|
15
|
+
non_didactic_modules: content_modules.non_visualization.not_didactic,
|
16
16
|
membership: options
|
17
17
|
.view_context
|
18
18
|
.view_membership(participant, participant.active_group)
|
@@ -35,7 +35,7 @@ module ContentProviders
|
|
35
35
|
.for_tool(tool)
|
36
36
|
.available_by(Time.zone.today)
|
37
37
|
.excludes_module(bit_core_content_module_id)
|
38
|
-
.
|
38
|
+
.not_terminated_on(Time.zone.today)
|
39
39
|
.latest_duplicate
|
40
40
|
end
|
41
41
|
end
|
data/app/models/membership.rb
CHANGED
@@ -129,7 +129,7 @@ class Membership < ActiveRecord::Base
|
|
129
129
|
end
|
130
130
|
|
131
131
|
def lessons_read
|
132
|
-
task_statuses.completed.select(&:
|
132
|
+
task_statuses.completed.select(&:lesson?)
|
133
133
|
end
|
134
134
|
|
135
135
|
def lessons_read_for_day(time)
|
@@ -138,7 +138,7 @@ class Membership < ActiveRecord::Base
|
|
138
138
|
.where("completed_at <= ? AND completed_at >= ?",
|
139
139
|
time.end_of_day,
|
140
140
|
time.beginning_of_day)
|
141
|
-
.select(&:
|
141
|
+
.select(&:lesson?)
|
142
142
|
end
|
143
143
|
|
144
144
|
def lessons_read_for_week
|
@@ -146,7 +146,7 @@ class Membership < ActiveRecord::Base
|
|
146
146
|
.completed
|
147
147
|
.where("completed_at >= ?", Time.current.advance(days: -7)
|
148
148
|
.beginning_of_day)
|
149
|
-
.select(&:
|
149
|
+
.select(&:lesson?)
|
150
150
|
end
|
151
151
|
|
152
152
|
def withdraw
|
data/app/models/participant.rb
CHANGED
@@ -95,7 +95,7 @@ class Participant < ActiveRecord::Base
|
|
95
95
|
where(is_admin: false)
|
96
96
|
}
|
97
97
|
|
98
|
-
def
|
98
|
+
def not_allowed_in_site?
|
99
99
|
# participant not set to is_complete (hence withdrawal or termination)
|
100
100
|
# and who have no active memberships
|
101
101
|
active_membership.nil? && !memberships.where(is_complete: true).exists?
|
data/app/models/task.rb
CHANGED
@@ -35,29 +35,25 @@ class Task < ActiveRecord::Base
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def incomplete_participant_list
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
42
|
-
end
|
38
|
+
Participant
|
39
|
+
.joins(memberships: :task_statuses)
|
40
|
+
.merge(task_statuses.non_moderator.incomplete)
|
43
41
|
end
|
44
42
|
|
45
43
|
def complete_participant_list
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
end
|
50
|
-
end
|
44
|
+
Participant
|
45
|
+
.joins(memberships: :task_statuses)
|
46
|
+
.merge(task_statuses.non_moderator.completed)
|
51
47
|
end
|
52
48
|
|
53
49
|
# Returns a count of the number of times this task was assigned.
|
54
50
|
def total_assigned
|
55
|
-
task_statuses.count
|
51
|
+
task_statuses.non_moderator.count
|
56
52
|
end
|
57
53
|
|
58
54
|
# Returns the count of the number of times this task was completed.
|
59
55
|
def total_read
|
60
|
-
task_statuses.
|
56
|
+
task_statuses.non_moderator.completed.count
|
61
57
|
end
|
62
58
|
|
63
59
|
private
|
data/app/models/task_status.rb
CHANGED
@@ -68,6 +68,11 @@ class TaskStatus < ActiveRecord::Base
|
|
68
68
|
)
|
69
69
|
}
|
70
70
|
|
71
|
+
scope :non_moderator, lambda {
|
72
|
+
joins(membership: :participant)
|
73
|
+
.merge(Participant.not_moderator)
|
74
|
+
}
|
75
|
+
|
71
76
|
scope :most_recent_for_content_module, lambda {|content_module, day_in_study|
|
72
77
|
for_content_module(content_module)
|
73
78
|
.available_by_day(day_in_study)
|
@@ -86,7 +91,7 @@ class TaskStatus < ActiveRecord::Base
|
|
86
91
|
end
|
87
92
|
end
|
88
93
|
|
89
|
-
def
|
94
|
+
def lesson?
|
90
95
|
task.bit_core_content_module.instance_of? ContentModules::LessonModule
|
91
96
|
end
|
92
97
|
|
@@ -40,7 +40,7 @@ module ThinkFeelDoEngine
|
|
40
40
|
day: enrollment_day,
|
41
41
|
event_date: date_sent,
|
42
42
|
event_time: time_sent.iso8601,
|
43
|
-
is_message_opened:
|
43
|
+
is_message_opened: message_read?,
|
44
44
|
message_opened_at: message_read_at.try(:iso8601),
|
45
45
|
message_subject: @message.subject,
|
46
46
|
message_content: @message.body
|
@@ -93,12 +93,12 @@ module ThinkFeelDoEngine
|
|
93
93
|
@message.sent_at
|
94
94
|
end
|
95
95
|
|
96
|
-
def
|
96
|
+
def message_read?
|
97
97
|
received_message.try(:is_read)
|
98
98
|
end
|
99
99
|
|
100
100
|
def message_read_at
|
101
|
-
|
101
|
+
message_read? && received_message.try(:updated_at)
|
102
102
|
end
|
103
103
|
|
104
104
|
def received_message
|
@@ -95,8 +95,8 @@ module ThinkFeelDoEngine
|
|
95
95
|
|
96
96
|
{
|
97
97
|
opened_at: last_event.emitted_at,
|
98
|
-
is_last_module_page:
|
99
|
-
|
98
|
+
is_last_module_page: last_module_page?(last_event.current_url,
|
99
|
+
module_id)
|
100
100
|
}
|
101
101
|
end
|
102
102
|
|
@@ -109,7 +109,7 @@ module ThinkFeelDoEngine
|
|
109
109
|
interaction
|
110
110
|
end
|
111
111
|
|
112
|
-
def self.
|
112
|
+
def self.last_module_page?(url, module_id)
|
113
113
|
# last provider within module
|
114
114
|
last_provider = BitCore::ContentModule.find(module_id)
|
115
115
|
.content_providers
|
data/app/models/tool_nav_item.rb
CHANGED
@@ -30,18 +30,18 @@ class ToolNavItem
|
|
30
30
|
!%w(RELAX SUPPORT).include?(tool.title)
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
33
|
+
def active?(current_module)
|
34
34
|
current_module.bit_core_tool_id == @tool.id
|
35
35
|
end
|
36
36
|
|
37
|
-
def
|
37
|
+
def generic_tool?
|
38
38
|
@tool.type.nil?
|
39
39
|
end
|
40
40
|
|
41
41
|
def module_nav_items
|
42
42
|
available_content_modules
|
43
43
|
.position_greater_than(1)
|
44
|
-
.
|
44
|
+
.non_visualization
|
45
45
|
.available_by(Time.zone.today)
|
46
46
|
.order_by_position
|
47
47
|
.latest_duplicate
|
@@ -49,8 +49,8 @@ class ToolNavItem
|
|
49
49
|
|
50
50
|
def any_incomplete_tasks_today?
|
51
51
|
available_content_modules
|
52
|
-
.
|
53
|
-
.
|
52
|
+
.non_visualization
|
53
|
+
.not_completed
|
54
54
|
.available_on(Time.zone.today)
|
55
55
|
.exists?
|
56
56
|
end
|
@@ -61,6 +61,6 @@ class ToolNavItem
|
|
61
61
|
AvailableContentModule
|
62
62
|
.for_tool(@tool)
|
63
63
|
.for_participant(@participant)
|
64
|
-
.
|
64
|
+
.not_terminated_on(Time.zone.today)
|
65
65
|
end
|
66
66
|
end
|
data/app/models/values/mood.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
<%= link_to fa_icon("home", text: "Home"), brand_location, data: { no_turbolink: true } %>
|
5
5
|
</li>
|
6
6
|
<% tool_navs.each do |tool_nav| %>
|
7
|
-
<li class="custom-snap-width <%= tool_nav.title %><%= tool_nav.
|
7
|
+
<li class="custom-snap-width <%= tool_nav.title %><%= tool_nav.active?(@navigator.current_module) ? " active" : "" %>">
|
8
8
|
<%= link_to think_feel_do_engine.navigator_context_path(context_name: tool_nav.title), data: { no_turbolink: true } do %>
|
9
9
|
<%= tool_nav.title %>
|
10
10
|
<% unless tool_nav.alert.nil? %>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<% tool_navs = ToolNavItem.for_participant(current_participant) %>
|
2
2
|
|
3
3
|
<% tool_navs.each do |tool_nav| %>
|
4
|
-
<% if tool_nav.
|
5
|
-
<li class="<%= tool_nav.title %> dropdown hidden-xs<%= tool_nav.
|
4
|
+
<% if tool_nav.generic_tool? %>
|
5
|
+
<li class="<%= tool_nav.title %> dropdown hidden-xs<%= tool_nav.active?(@navigator.current_module) ? " active" : "" %>">
|
6
6
|
<%= link_to "#", class: "dropdown-toggle", data: { toggle: "dropdown" } do %>
|
7
7
|
<%= tool_nav.title %>
|
8
8
|
<% unless tool_nav.alert.nil? %>
|
@@ -36,7 +36,7 @@
|
|
36
36
|
</ul>
|
37
37
|
</li>
|
38
38
|
<% else %>
|
39
|
-
<li class="<%= tool_nav.title %> hidden-xs<%= tool_nav.
|
39
|
+
<li class="<%= tool_nav.title %> hidden-xs<%= tool_nav.active?(@navigator.current_module) ? " active" : "" %>">
|
40
40
|
<%= link_to think_feel_do_engine.navigator_context_path(context_name: tool_nav.title), data: { no_turbolink: true } do %>
|
41
41
|
<%= tool_nav.title %>
|
42
42
|
<% unless tool_nav.alert.nil? %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class ConvertEventPayloads < ActiveRecord::Migration
|
2
|
+
class EventMigration < ActiveRecord::Base
|
3
|
+
self.table_name = :event_capture_events
|
4
|
+
|
5
|
+
serialize :payload
|
6
|
+
end
|
7
|
+
|
8
|
+
def up
|
9
|
+
EventMigration.find_each do |event|
|
10
|
+
next unless event.payload.respond_to?(:to_unsafe_h)
|
11
|
+
|
12
|
+
# Use 'update_column' because with 'update' ActiveRecord will try to
|
13
|
+
# deserialize the existing value first, and will detect that there are
|
14
|
+
# two identical Hashes. Use 'to_unsafe_h' because otherwise all keys
|
15
|
+
# will be deemed unsafe, having not been permitted via the strong
|
16
|
+
# parameters API.
|
17
|
+
event.update_column :payload, event.payload.to_unsafe_h
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def down
|
22
|
+
end
|
23
|
+
end
|
@@ -8,7 +8,7 @@ namespace :lesson_notifications do
|
|
8
8
|
now = Time.now
|
9
9
|
Membership.active.each do |membership|
|
10
10
|
membership.task_statuses.each do |task_status|
|
11
|
-
next unless task_status.
|
11
|
+
next unless task_status.lesson? && task_status.notify_today?
|
12
12
|
|
13
13
|
participant = task_status.participant
|
14
14
|
content_module = task_status.task.bit_core_content_module
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: think_feel_do_engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Carty-Fickes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -963,6 +963,8 @@ files:
|
|
963
963
|
- db/migrate/20160408185958_add_event_composite_index_participant_kind.rb
|
964
964
|
- db/migrate/20160516143153_remove_gratitude_recording.rb
|
965
965
|
- db/migrate/20160516143322_remove_experience.rb
|
966
|
+
- db/migrate/20160616162347_convert_slide_options.rb
|
967
|
+
- db/migrate/20160616201120_convert_event_payloads.rb
|
966
968
|
- lib/tasks/lesson_notifications.rake
|
967
969
|
- lib/tasks/seed.rake
|
968
970
|
- lib/tasks/think_feel_do_engine_tasks.rake
|
@@ -1003,8 +1005,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1003
1005
|
version: '0'
|
1004
1006
|
requirements: []
|
1005
1007
|
rubyforge_project:
|
1006
|
-
rubygems_version: 2.
|
1008
|
+
rubygems_version: 2.6.4
|
1007
1009
|
signing_key:
|
1008
1010
|
specification_version: 4
|
1009
1011
|
summary: Summary of ThinkFeelDoEngine.
|
1010
1012
|
test_files: []
|
1013
|
+
has_rdoc:
|