think_feel_do_engine 3.19.7 → 3.19.8
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/bit_maker/content_modules_controller.rb +16 -2
- data/app/controllers/think_feel_do_engine/coach/messages_controller.rb +1 -1
- data/app/controllers/think_feel_do_engine/lessons_controller.rb +1 -1
- data/app/controllers/think_feel_do_engine/manage/tasks_controller.rb +2 -2
- data/app/controllers/think_feel_do_engine/participants/assessments_controller.rb +4 -4
- data/app/helpers/think_feel_do_engine/coach/group_dashboard_helper.rb +2 -0
- data/app/helpers/think_feel_do_engine/phq_assessment_helper.rb +1 -1
- data/app/helpers/think_feel_do_engine/tasks_helper.rb +1 -1
- data/app/models/activity.rb +6 -2
- data/app/models/content_providers/past_activity_form.rb +2 -1
- data/app/models/content_providers/unhelpful_thoughts_list_provider.rb +15 -10
- data/app/models/message_sms_notification.rb +1 -1
- data/app/models/phq_assessment.rb +2 -2
- data/app/models/think_feel_do_engine/reports/lesson_module.rb +4 -4
- data/app/models/think_feel_do_engine/reports/module_page_view.rb +1 -1
- data/app/models/think_feel_do_engine/reports/module_session.rb +2 -2
- data/app/models/think_feel_do_engine/reports/tool_module.rb +2 -0
- data/app/models/thought.rb +5 -5
- data/app/models/wai_assessment.rb +2 -2
- data/lib/think_feel_do_engine/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44490ab377c55a5697d0f9cd55455ef8dbd7e365
|
4
|
+
data.tar.gz: 97c16cd8be6225e6527fa30bc7cf50663e5f7213
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0109f1af1b2d18f7082394276e1bd5b078e41202b3c21dc02509d23dba4e56480dbe0b566a39caec9575e3ce6e716a9c8925d123002640aa96a9e508eb223e7f
|
7
|
+
data.tar.gz: 31afec2473200a51f94d1096f0f16ce83d8e2e7a8d7bcb4c6b5957d61120675c72e4e590bb29cd03459a2a1f7fc3f2282aacb7ac5ccfc07bafb7549f3756b55e
|
@@ -5,6 +5,7 @@ module ThinkFeelDoEngine
|
|
5
5
|
# Enables users to create, update, and delete modules
|
6
6
|
# These modules contain providers that display content to the participants
|
7
7
|
class ContentModulesController < ApplicationController
|
8
|
+
ARM_NOT_FOUND_MESSAGE = "Unable to find that arm.".freeze
|
8
9
|
before_action :authenticate_user!, :set_arm, :set_tools
|
9
10
|
before_action :set_content_module, only: [:show, :edit, :update, :destroy]
|
10
11
|
load_and_authorize_resource only: [:show, :edit, :update, :destroy]
|
@@ -116,8 +117,21 @@ module ThinkFeelDoEngine
|
|
116
117
|
end
|
117
118
|
|
118
119
|
def record_not_found
|
119
|
-
|
120
|
-
|
120
|
+
if @arm.is_a?(Arm)
|
121
|
+
redirect_to arm_bit_maker_content_modules_path(@arm),
|
122
|
+
alert: "Unable to find content module."
|
123
|
+
else
|
124
|
+
arm_not_found_path
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def arm_not_found_path
|
129
|
+
if defined?(think_feel_do_dashboard)
|
130
|
+
redirect_to think_feel_do_dashboard.arms_path,
|
131
|
+
alert: ARM_NOT_FOUND_MESSAGE
|
132
|
+
else
|
133
|
+
redirect_to privacy_policy_path, alert: ARM_NOT_FOUND_MESSAGE
|
134
|
+
end
|
121
135
|
end
|
122
136
|
end
|
123
137
|
end
|
@@ -42,7 +42,7 @@ module ThinkFeelDoEngine
|
|
42
42
|
redirect_to coach_group_messages_url(@group), notice: "Message saved"
|
43
43
|
else
|
44
44
|
errors = @message.errors.full_messages.join(", ")
|
45
|
-
redirect_to :back, alert: "Unable to save message: #{
|
45
|
+
redirect_to :back, alert: "Unable to save message: #{errors}"
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
@@ -21,7 +21,7 @@ module ThinkFeelDoEngine
|
|
21
21
|
notice: "Task assigned."
|
22
22
|
else
|
23
23
|
errors = @task.errors.full_messages.join(", ")
|
24
|
-
flash[:alert] = "Unable to assign task: #{
|
24
|
+
flash[:alert] = "Unable to assign task: #{errors}"
|
25
25
|
redirect_to arm_manage_tasks_group_path(@group.arm, @group)
|
26
26
|
end
|
27
27
|
end
|
@@ -36,7 +36,7 @@ module ThinkFeelDoEngine
|
|
36
36
|
flash[:success] = "Task unassigned from group."
|
37
37
|
else
|
38
38
|
errors = @task.errors.full_messages.join(", ")
|
39
|
-
flash[:alert] = "Unable to delete task from group: #{
|
39
|
+
flash[:alert] = "Unable to delete task from group: #{errors}"
|
40
40
|
end
|
41
41
|
redirect_to arm_manage_tasks_group_path(group.arm, group)
|
42
42
|
end
|
@@ -12,7 +12,7 @@ module ThinkFeelDoEngine
|
|
12
12
|
@assessment = build_assessment(release_date: @token.release_date)
|
13
13
|
|
14
14
|
render "think_feel_do_engine/participants/assessments/" \
|
15
|
-
"new_#{
|
15
|
+
"new_#{assessment_name}"
|
16
16
|
end
|
17
17
|
|
18
18
|
def create
|
@@ -26,15 +26,15 @@ module ThinkFeelDoEngine
|
|
26
26
|
@assessment = build_assessment(release_date: @token.release_date)
|
27
27
|
|
28
28
|
render "think_feel_do_engine/participants/assessments/" \
|
29
|
-
"new_#{
|
29
|
+
"new_#{assessment_name}"
|
30
30
|
else
|
31
31
|
render :success
|
32
32
|
end
|
33
33
|
else
|
34
34
|
errors = @assessment.errors.full_messages.join(", ")
|
35
|
-
flash.now[:alert] = "Unable to save assessment: #{
|
35
|
+
flash.now[:alert] = "Unable to save assessment: #{errors}"
|
36
36
|
render "think_feel_do_engine/participants/assessments/" \
|
37
|
-
"new_#{
|
37
|
+
"new_#{assessment_name}"
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module ThinkFeelDoEngine
|
2
2
|
module Coach
|
3
3
|
# Displays navigational information in the form of breadcrumbs
|
4
|
+
# rubocop:disable Metrics/ModuleLength
|
4
5
|
module GroupDashboardHelper
|
5
6
|
def social_likes_and_comments_column_headers
|
6
7
|
if social_features?
|
@@ -152,5 +153,6 @@ module ThinkFeelDoEngine
|
|
152
153
|
end
|
153
154
|
end
|
154
155
|
end
|
156
|
+
# rubocop:enable Metrics/ModuleLength
|
155
157
|
end
|
156
158
|
end
|
data/app/models/activity.rb
CHANGED
@@ -343,8 +343,12 @@ class Activity < ActiveRecord::Base
|
|
343
343
|
end
|
344
344
|
|
345
345
|
def create_activity_type
|
346
|
-
new_title = activity_type_new_title.present?
|
347
|
-
|
346
|
+
new_title = if activity_type_new_title.present?
|
347
|
+
activity_type_new_title
|
348
|
+
else
|
349
|
+
activity_type_title
|
350
|
+
end
|
351
|
+
|
348
352
|
if new_title
|
349
353
|
activity_types = participant.activity_types
|
350
354
|
|
@@ -43,7 +43,8 @@ module ContentProviders
|
|
43
43
|
|
44
44
|
def timestamps(participant)
|
45
45
|
period = most_recent_awake_period(participant)
|
46
|
-
start_time
|
46
|
+
start_time = period.start_time
|
47
|
+
end_time = period.end_time
|
47
48
|
times = []
|
48
49
|
(start_time.to_i..(end_time.to_i - 1.hour)).step(1.hour) do |timestamp|
|
49
50
|
times << timestamp
|
@@ -34,30 +34,35 @@ module ContentProviders
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
+
def report_missing_module
|
38
|
+
return unless defined? Raven
|
39
|
+
|
40
|
+
event = Raven::Event.new(message: "one of the thought modules " \
|
41
|
+
"couldn't be found via title")
|
42
|
+
Raven.send(event)
|
43
|
+
end
|
44
|
+
|
37
45
|
def provider_postscript
|
38
46
|
if @thoughts.count > 0
|
39
47
|
"We're going to ask you to challenge each thought:"
|
40
48
|
else
|
41
|
-
title_1
|
49
|
+
title_1 = "#1 Identifying"
|
50
|
+
title_2 = "Add a New Harmful Thought"
|
42
51
|
module_1 = BitCore::ContentModule.find_by_title(title_1)
|
43
52
|
module_2 = BitCore::ContentModule.find_by_title(title_2)
|
44
53
|
|
45
54
|
if module_1 && module_2
|
46
55
|
"You can log more thoughts in " \
|
47
|
-
"#{
|
56
|
+
"#{@view.link_to(
|
48
57
|
title_1,
|
49
58
|
@view.navigator_location_path(module_id: module_1.id),
|
50
|
-
style: 'font-size: larger;')
|
51
|
-
"#{
|
59
|
+
style: 'font-size: larger;')} or use " \
|
60
|
+
"#{@view.link_to(
|
52
61
|
title_2,
|
53
62
|
@view.navigator_location_path(module_id: module_2.id),
|
54
|
-
style: 'font-size: larger;')
|
63
|
+
style: 'font-size: larger;')} to do multiple steps at once."
|
55
64
|
else
|
56
|
-
|
57
|
-
event = Raven::Event.new(message: "one of the thought modules " \
|
58
|
-
"couldn't be found via title")
|
59
|
-
Raven.send(event)
|
60
|
-
end
|
65
|
+
report_missing_module
|
61
66
|
|
62
67
|
nil
|
63
68
|
end
|
@@ -48,8 +48,8 @@ class PhqAssessment < ActiveRecord::Base
|
|
48
48
|
|
49
49
|
if answered_questions.min < MIN_QUESTION_SCORE ||
|
50
50
|
answered_questions.max > MAX_QUESTION_SCORE
|
51
|
-
errors.add(:base, "scores must be between #{
|
52
|
-
"and #{
|
51
|
+
errors.add(:base, "scores must be between #{MIN_QUESTION_SCORE} " \
|
52
|
+
"and #{MAX_QUESTION_SCORE} inclusive")
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
@@ -4,7 +4,7 @@ module ThinkFeelDoEngine
|
|
4
4
|
module LessonModule
|
5
5
|
URL_ROOT_RE = /^[^\/]*\/\/[^\/]+/
|
6
6
|
# Disabling method length due to nested methods.
|
7
|
-
# rubocop:disable Metrics/MethodLength
|
7
|
+
# rubocop:disable Metrics/MethodLength,Lint/NestedMethodDefinition
|
8
8
|
def self.included(klass)
|
9
9
|
class << klass
|
10
10
|
# Returns a hash mapping lesson entry (first slide) path to Lesson
|
@@ -17,7 +17,7 @@ module ThinkFeelDoEngine
|
|
17
17
|
path = navigator_location_path(module_id: m.id,
|
18
18
|
provider_id: first_provider_id,
|
19
19
|
content_position: 1)
|
20
|
-
["#{
|
20
|
+
["#{path}", m.id]
|
21
21
|
end.compact
|
22
22
|
|
23
23
|
Hash[lessons]
|
@@ -28,7 +28,7 @@ module ThinkFeelDoEngine
|
|
28
28
|
lessons = ContentModules::LessonModule.all.map do |m|
|
29
29
|
path = navigator_location_path(module_id: m.id)
|
30
30
|
|
31
|
-
["#{
|
31
|
+
["#{path}", m.id]
|
32
32
|
end
|
33
33
|
|
34
34
|
Hash[lessons]
|
@@ -42,7 +42,7 @@ module ThinkFeelDoEngine
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
45
|
-
# rubocop:enable Metrics/LineLength
|
45
|
+
# rubocop:enable Metrics/LineLength,Lint/NestedMethodDefinition
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -49,7 +49,7 @@ module ThinkFeelDoEngine
|
|
49
49
|
.order(:emitted_at)
|
50
50
|
.where("emitted_at > ? AND payload NOT LIKE ?",
|
51
51
|
page_render_event.emitted_at,
|
52
|
-
"%currentUrl: #{
|
52
|
+
"%currentUrl: #{page_render_event.current_url}\n%")
|
53
53
|
.select(:emitted_at).limit(1).first.try(:emitted_at)
|
54
54
|
end
|
55
55
|
end
|
@@ -118,8 +118,8 @@ module ThinkFeelDoEngine
|
|
118
118
|
if last_provider.nil?
|
119
119
|
false
|
120
120
|
else
|
121
|
-
provider_re = "modules\/#{
|
122
|
-
"providers\/#{
|
121
|
+
provider_re = "modules\/#{module_id}\/" \
|
122
|
+
"providers\/#{last_provider.id}(\/.*)?$"
|
123
123
|
|
124
124
|
!url.match(/#{ provider_re }/).nil?
|
125
125
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module ThinkFeelDoEngine
|
2
2
|
module Reports
|
3
3
|
# Helper methods for reporting on modules.
|
4
|
+
# rubocop:disable Lint/NestedMethodDefinition
|
4
5
|
module ToolModule
|
5
6
|
URL_ROOT_RE = /^[^\/]*\/\/[^\/]+/
|
6
7
|
|
@@ -25,5 +26,6 @@ module ThinkFeelDoEngine
|
|
25
26
|
end
|
26
27
|
end
|
27
28
|
end
|
29
|
+
# rubocop:enable Lint/NestedMethodDefinition
|
28
30
|
end
|
29
31
|
end
|
data/app/models/thought.rb
CHANGED
@@ -61,20 +61,20 @@ class Thought < ActiveRecord::Base
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def shared_description
|
64
|
-
"Thought: #{
|
64
|
+
"Thought: #{content}"
|
65
65
|
end
|
66
66
|
|
67
67
|
private
|
68
68
|
|
69
69
|
def clean_attributes
|
70
|
-
|
70
|
+
clean_attribute = lambda do |attr|
|
71
71
|
if self[attr].respond_to?(:strip)
|
72
72
|
cleaned = self[attr].strip
|
73
|
-
send("#{
|
73
|
+
send("#{attr}=", cleaned == "" ? nil : cleaned)
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
-
clean_attribute(:challenging_thought)
|
78
|
-
clean_attribute(:act_as_if)
|
77
|
+
clean_attribute.call(:challenging_thought)
|
78
|
+
clean_attribute.call(:act_as_if)
|
79
79
|
end
|
80
80
|
end
|
@@ -19,8 +19,8 @@ class WaiAssessment < ActiveRecord::Base
|
|
19
19
|
|
20
20
|
if remove_nils.min < MIN_QUESTION_SCORE ||
|
21
21
|
remove_nils.max > MAX_QUESTION_SCORE
|
22
|
-
errors.add(:base, "scores must be between #{
|
23
|
-
"and #{
|
22
|
+
errors.add(:base, "scores must be between #{MIN_QUESTION_SCORE} " \
|
23
|
+
"and #{MAX_QUESTION_SCORE} inclusive")
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: think_feel_do_engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.19.
|
4
|
+
version: 3.19.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Carty-Fickes
|
@@ -988,7 +988,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
988
988
|
version: '0'
|
989
989
|
requirements: []
|
990
990
|
rubyforge_project:
|
991
|
-
rubygems_version: 2.
|
991
|
+
rubygems_version: 2.6.4
|
992
992
|
signing_key:
|
993
993
|
specification_version: 4
|
994
994
|
summary: Summary of ThinkFeelDoEngine.
|