think_feel_do_engine 3.17.0 → 3.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/think_feel_do_engine/navigator_controller.rb +45 -6
- data/app/models/engagement.rb +7 -0
- data/app/models/task_status.rb +7 -0
- data/app/views/think_feel_do_engine/experiences/index_provider.html.erb +4 -0
- data/app/views/think_feel_do_engine/gratitude_recordings/index_provider.html.erb +4 -0
- data/lib/think_feel_do_engine/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5570eaecc8f5761108504851cff534b4affc478
|
4
|
+
data.tar.gz: f4bf721ad515aa07b14583738741830d40b7b006
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49ee0eb5def617f3789c8d5070473c262cee74d83656b3ce73c8eef237d25396567129351fe8bcc41c6f75ab04972c71f16ba5b3de1c0e1be13e31dd72355f62
|
7
|
+
data.tar.gz: e1673c9bad39b0c395636811198c33b8a83ea42b693ba52b66a43057839f37f5159dc4d5629f91719092ad4ff8ac195daef5e7b57590017cfd047dcc9c7a74f6
|
@@ -9,6 +9,7 @@ module ThinkFeelDoEngine
|
|
9
9
|
|
10
10
|
URL_GENERATION_ALERT = "We're sorry, the content you were looking "\
|
11
11
|
" for couldn't be found."
|
12
|
+
FIRST_CONTENT_POSITION = 1
|
12
13
|
|
13
14
|
layout "tool"
|
14
15
|
|
@@ -26,7 +27,9 @@ module ThinkFeelDoEngine
|
|
26
27
|
content_position: params[:content_position]
|
27
28
|
)
|
28
29
|
|
29
|
-
complete_task_status(params[:module_id]
|
30
|
+
complete_task_status(params[:module_id],
|
31
|
+
params[:provider_id],
|
32
|
+
params[:content_position])
|
30
33
|
|
31
34
|
render "show_content"
|
32
35
|
rescue ActiveRecord::RecordNotFound, ActionView::Template::Error
|
@@ -36,6 +39,7 @@ module ThinkFeelDoEngine
|
|
36
39
|
end
|
37
40
|
|
38
41
|
def show_next_content
|
42
|
+
mark_engagement_completed
|
39
43
|
@navigator.fetch_next_content
|
40
44
|
|
41
45
|
if @navigator.current_module
|
@@ -77,19 +81,54 @@ module ThinkFeelDoEngine
|
|
77
81
|
|
78
82
|
private
|
79
83
|
|
80
|
-
def
|
84
|
+
def last_engagment
|
85
|
+
current_participant
|
86
|
+
.active_membership
|
87
|
+
.task_statuses
|
88
|
+
.for_content_module(navigator_content_module)
|
89
|
+
.try(:last)
|
90
|
+
.try(:engagements)
|
91
|
+
.try(:last)
|
92
|
+
end
|
93
|
+
|
94
|
+
def complete_task_status(module_id, provider_id, content_id)
|
81
95
|
content_module = BitCore::ContentModule.find(module_id)
|
82
96
|
membership = current_participant
|
83
97
|
.active_membership
|
84
98
|
@task_status = membership
|
85
99
|
.task_statuses
|
86
|
-
.
|
87
|
-
|
88
|
-
.
|
89
|
-
|
100
|
+
.most_recent_for_content_module(content_module,
|
101
|
+
membership.day_in_study)
|
102
|
+
.first
|
103
|
+
if @task_status &&
|
104
|
+
(!content_specified?(provider_id, content_id) ||
|
105
|
+
first_content_slide?(content_module, provider_id, content_id))
|
106
|
+
@task_status
|
107
|
+
.engagements
|
108
|
+
.build
|
109
|
+
end
|
90
110
|
@task_status.mark_complete unless @task_status.nil?
|
91
111
|
end
|
92
112
|
|
113
|
+
def first_content_slide?(content_module, provider_id, content_id)
|
114
|
+
first_content_provider = content_module
|
115
|
+
.content_providers
|
116
|
+
.order(:position)
|
117
|
+
.first
|
118
|
+
provider_id == first_content_provider.id.to_s &&
|
119
|
+
content_id == FIRST_CONTENT_POSITION
|
120
|
+
end
|
121
|
+
|
122
|
+
def mark_engagement_completed
|
123
|
+
if navigator_content_module && last_engagment
|
124
|
+
last_engagment.update_attributes(completed_at: DateTime.current)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def content_specified?(provider_id, content_id)
|
129
|
+
!provider_id.blank? && !content_id.blank?
|
130
|
+
end
|
131
|
+
|
93
132
|
def module_exist?
|
94
133
|
@navigator
|
95
134
|
.current_module
|
data/app/models/task_status.rb
CHANGED
@@ -6,6 +6,7 @@ class TaskStatus < ActiveRecord::Base
|
|
6
6
|
belongs_to :membership
|
7
7
|
belongs_to :task
|
8
8
|
has_one :participant, through: :membership
|
9
|
+
has_many :engagements, dependent: :destroy
|
9
10
|
|
10
11
|
delegate :bit_core_content_module,
|
11
12
|
:bit_core_content_module_id,
|
@@ -65,6 +66,12 @@ class TaskStatus < ActiveRecord::Base
|
|
65
66
|
)
|
66
67
|
}
|
67
68
|
|
69
|
+
scope :most_recent_for_content_module, lambda {|content_module, day_in_study|
|
70
|
+
for_content_module(content_module)
|
71
|
+
.available_by_day(day_in_study)
|
72
|
+
.order("start_day DESC")
|
73
|
+
}
|
74
|
+
|
68
75
|
def provider_viz?
|
69
76
|
try(:bit_core_content_module).try(:is_viz)
|
70
77
|
end
|
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.17.
|
4
|
+
version: 3.17.1
|
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-05-
|
11
|
+
date: 2016-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -503,6 +503,7 @@ files:
|
|
503
503
|
- app/models/delivered_message.rb
|
504
504
|
- app/models/emotion.rb
|
505
505
|
- app/models/emotional_rating.rb
|
506
|
+
- app/models/engagement.rb
|
506
507
|
- app/models/experience.rb
|
507
508
|
- app/models/gratitude_recording.rb
|
508
509
|
- app/models/group.rb
|