think_feel_do_engine 3.14.1 → 3.14.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e391e94351aed9559325f99b1e2c873a7a90051
4
- data.tar.gz: 60fd151c40b2bea03832755032f577b081541488
3
+ metadata.gz: 87a27bee53ec55a100c20dbd9b2102aea9b1675f
4
+ data.tar.gz: e6f94f97ace1fc6b05545d9e4ba305a2fc89f632
5
5
  SHA512:
6
- metadata.gz: 1687e2ae569ac8b8780293c7d9b2a939df6870c20f8284bcdffbc5223df29c36260f408129b6d2e10d9c306a21b4de510a6b33d6561d0aa55be634929b314f0d
7
- data.tar.gz: d4e7897f71c5e1e180df68844b7283e4c64bf581199494044ad28b8122d625127c779fa450881a464e605b16a8e0436e6b5c20f1e7eb950a0fa4621de6f77376
6
+ metadata.gz: 3717a2bb4678d29db736dcbd06e02ce415615bf87b642c96770bb1fbf07a266601fd26f87ce43d5c912e59eb9ec9662a781d9668bad71684618ac30b4f9e420f
7
+ data.tar.gz: 645338da6fdf28927ab8158bd7eec544568abfd1c19bfc7ba294298b8196eeb7b8c0e32a570a1222cada4cf53e4fc9b528b0cd4a95a0f84be92eac393fa85ac6
@@ -0,0 +1,43 @@
1
+ module Concerns
2
+ # Determines whether a participant can access a lesson
3
+ module Accessibility
4
+ def accessible?
5
+ available_for_learning_on <= Date.today
6
+ end
7
+
8
+ def available_for_learning_on
9
+ membership.start_date + release_day - 1
10
+ end
11
+
12
+ def completed?
13
+ completed_at.present?
14
+ end
15
+
16
+ def previous_completed?
17
+ return false unless learning_task_status_index
18
+ return true if learning_task_status_first?
19
+ self
20
+ .class
21
+ .find_by_id(learning_task_statuses.ids[learning_task_status_index - 1])
22
+ .completed?
23
+ end
24
+
25
+ private
26
+
27
+ def learning_task_status_first?
28
+ learning_task_status_index.zero?
29
+ end
30
+
31
+ def learning_task_status_index
32
+ learning_task_statuses
33
+ .ids
34
+ .find_index(id)
35
+ end
36
+
37
+ def learning_task_statuses
38
+ membership
39
+ .ordered_task_statuses
40
+ .for_learning
41
+ end
42
+ end
43
+ end
@@ -59,11 +59,10 @@ class Membership < ActiveRecord::Base
59
59
  .by_position
60
60
  end
61
61
 
62
- def ordered_task_status_ids
62
+ def ordered_task_statuses
63
63
  task_statuses
64
64
  .joins(:task)
65
65
  .order("tasks.release_day ASC")
66
- .ids
67
66
  end
68
67
 
69
68
  def incomplete_tasks
@@ -1,5 +1,8 @@
1
1
  # Holds the completion status of a task for each participant
2
2
  class TaskStatus < ActiveRecord::Base
3
+ include Concerns::Accessibility
4
+ LESSON_MODULE_TYPE = "ContentModules::LessonModule"
5
+
3
6
  belongs_to :membership
4
7
  belongs_to :task
5
8
  has_one :participant, through: :membership
@@ -31,6 +34,11 @@ class TaskStatus < ActiveRecord::Base
31
34
  .order("bit_core_content_modules.position ASC")
32
35
  }
33
36
 
37
+ scope :for_learning, lambda {
38
+ joins(:task, task: :bit_core_content_module)
39
+ .where("bit_core_content_modules.type = '#{LESSON_MODULE_TYPE}'")
40
+ }
41
+
34
42
  scope :available_by_day, lambda { |day_in_study|
35
43
  where(arel_table[:start_day].lteq(day_in_study))
36
44
  }
@@ -56,22 +64,6 @@ class TaskStatus < ActiveRecord::Base
56
64
  )
57
65
  }
58
66
 
59
- def accessible?
60
- available_for_learning_on <= Date.today
61
- end
62
-
63
- def completed?
64
- completed_at.present?
65
- end
66
-
67
- def previous_completed?
68
- return true if is_first?
69
- self
70
- .class
71
- .find_by_id(membership_task_status_ids[index_for_membership - 1])
72
- .completed?
73
- end
74
-
75
67
  def provider_viz?
76
68
  try(:bit_core_content_module).try(:is_viz)
77
69
  end
@@ -85,31 +77,11 @@ class TaskStatus < ActiveRecord::Base
85
77
  end
86
78
 
87
79
  def is_lesson?
88
- task.bit_core_content_module.type == "ContentModules::LessonModule"
80
+ task.bit_core_content_module.instance_of? ContentModules::LessonModule
89
81
  end
90
82
 
91
83
  def notify_today?
92
84
  today = Time.now
93
85
  start_day == ((today.to_date - membership.start_date.to_date).to_i + 1)
94
86
  end
95
-
96
- def available_for_learning_on
97
- membership.start_date + release_day - 1
98
- end
99
-
100
- private
101
-
102
- def index_for_membership
103
- membership_task_status_ids
104
- .find_index(id)
105
- end
106
-
107
- def is_first?
108
- index_for_membership.zero?
109
- end
110
-
111
- def membership_task_status_ids
112
- membership
113
- .ordered_task_status_ids
114
- end
115
87
  end
@@ -16,10 +16,12 @@
16
16
 
17
17
  <table class="table responsive <%=table_name%>">
18
18
  <thead>
19
- <th>Activity Test</th>
20
- <th>Planned For</th>
21
- <th>Predicted Pleasure Value</th>
22
- <th>Predicted Accomplishment Value</th>
19
+ <tr>
20
+ <th>Activity Test</th>
21
+ <th>Planned For</th>
22
+ <th>Predicted Pleasure Value</th>
23
+ <th>Predicted Accomplishment Value</th>
24
+ </tr>
23
25
  </thead>
24
26
  <tbody>
25
27
  <%= render partial: 'think_feel_do_engine/activities/past_due_rows', collection: activity_list, as: :activity %>
@@ -1,9 +1,11 @@
1
1
  <table class="table table-condensed" id="previous_activities">
2
2
  <thead>
3
- <th>Activity</th>
4
- <th>Planned For</th>
5
- <th>Predicted Pleasure Value</th>
6
- <th>Predicted Accomplishment Value</th>
3
+ <tr>
4
+ <th>Activity</th>
5
+ <th>Planned For</th>
6
+ <th>Predicted Pleasure Value</th>
7
+ <th>Predicted Accomplishment Value</th>
8
+ </tr>
7
9
  </thead>
8
10
  <tbody>
9
11
  <%= render partial: "think_feel_do_engine/activities/previously_planned", collection: activities_list, as: :activity
@@ -4,10 +4,12 @@
4
4
 
5
5
  <table class="table table-condensed" id="previous_activities">
6
6
  <thead>
7
- <th>Activity</th>
8
- <th>Planned For</th>
9
- <th>Predicted Pleasure Value</th>
10
- <th>Predicted Accomplishment Value</th>
7
+ <tr>
8
+ <th>Activity</th>
9
+ <th>Planned For</th>
10
+ <th>Predicted Pleasure Value</th>
11
+ <th>Predicted Accomplishment Value</th>
12
+ </tr>
11
13
  </thead>
12
14
  <tbody>
13
15
  <%= render partial: "think_feel_do_engine/activities/previously_planned", collection: already_sched_activities, as: :activity %>
@@ -28,9 +28,11 @@
28
28
  <% else %>
29
29
  <table class="table table-hover">
30
30
  <thead>
31
- <th>Week #</th>
32
- <th>Date</th>
33
- <th>PHQ-9 Score</th>
31
+ <tr>
32
+ <th>Week #</th>
33
+ <th>Date</th>
34
+ <th>PHQ-9 Score</th>
35
+ </tr>
34
36
  </thead>
35
37
  <tbody>
36
38
  <%= render partial: "think_feel_do_engine/coach/patient_dashboards/phq_summary", collection: suggestion.assessments, as: :tested_weeks, locals: { test_summary: suggestion.results } %>
@@ -2,8 +2,10 @@
2
2
 
3
3
  <table class="table table-hover">
4
4
  <thead>
5
- <th>Test</th>
6
- <th>Result</th>
5
+ <tr>
6
+ <th>Test</th>
7
+ <th>Result</th>
8
+ </tr>
7
9
  </thead>
8
10
  <tbody>
9
11
  <tr>
@@ -52,12 +52,14 @@
52
52
 
53
53
  <table class="table table-hover" id="tasks">
54
54
  <thead>
55
- <th>Title</th>
56
- <th>Release day</th>
57
- <th>Is recurring?</th>
58
- <th>Termination day</th>
59
- <th>Has didactic content?</th>
60
- <th></th>
55
+ <tr>
56
+ <th>Title</th>
57
+ <th>Release day</th>
58
+ <th>Is recurring?</th>
59
+ <th>Termination day</th>
60
+ <th>Has didactic content?</th>
61
+ <th></th>
62
+ </tr>
61
63
  </thead>
62
64
  <tbody>
63
65
  <% @group.tasks.each do |task|%>
@@ -11,13 +11,15 @@
11
11
  <%= form_tag participants_thoughts_path, remote: true do %>
12
12
  <table class="table table-hover data-table responsive" id="thoughts">
13
13
  <thead>
14
- <th class="not-displayed"></th>
15
- <th>Thought</th>
16
- <th>Pattern</th>
17
- <th>Challenging Thought</th>
18
- <th>As If Action</th>
19
- <th>Date</th>
20
- <th></th>
14
+ <tr>
15
+ <th class="not-displayed"></th>
16
+ <th>Thought</th>
17
+ <th>Pattern</th>
18
+ <th>Challenging Thought</th>
19
+ <th>As If Action</th>
20
+ <th>Date</th>
21
+ <th></th>
22
+ </tr>
21
23
  </thead>
22
24
  <tbody>
23
25
  <%= render partial: "think_feel_do_engine/thoughts/mutable_thought", collection: thoughts.order(created_at: :desc) %>
@@ -1,4 +1,4 @@
1
1
  # nodoc
2
2
  module ThinkFeelDoEngine
3
- VERSION = "3.14.1"
3
+ VERSION = "3.14.2"
4
4
  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.14.1
4
+ version: 3.14.2
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-03-23 00:00:00.000000000 Z
11
+ date: 2016-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -448,6 +448,7 @@ files:
448
448
  - app/models/awake_period.rb
449
449
  - app/models/bit_core/slide_observer.rb
450
450
  - app/models/coach_assignment.rb
451
+ - app/models/concerns/accessibility.rb
451
452
  - app/models/concerns/copier.rb
452
453
  - app/models/content_modules.rb
453
454
  - app/models/content_modules/lesson_module.rb