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.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/think_feel_do_engine/coach/group_dashboard_controller.rb +1 -1
  3. data/app/controllers/think_feel_do_engine/participants/passwords_controller.rb +1 -1
  4. data/app/controllers/think_feel_do_engine/users/registrations_controller.rb +1 -1
  5. data/app/helpers/think_feel_do_engine/activities_helper.rb +1 -1
  6. data/app/helpers/think_feel_do_engine/brand_helper.rb +1 -1
  7. data/app/helpers/think_feel_do_engine/presenters_helper.rb +1 -1
  8. data/app/models/available_content_module.rb +8 -8
  9. data/app/models/content_providers/module_index_provider.rb +3 -3
  10. data/app/models/membership.rb +3 -3
  11. data/app/models/participant.rb +1 -1
  12. data/app/models/task.rb +8 -12
  13. data/app/models/task_status.rb +6 -1
  14. data/app/models/think_feel_do_engine/reports/messaging.rb +3 -3
  15. data/app/models/think_feel_do_engine/reports/module_session.rb +3 -3
  16. data/app/models/think_feel_do_engine/reports/patient_activity.rb +1 -1
  17. data/app/models/tool_nav_item.rb +6 -6
  18. data/app/models/values/accomplishment.rb +1 -1
  19. data/app/models/values/emotional_rating.rb +1 -1
  20. data/app/models/values/mood.rb +1 -1
  21. data/app/views/think_feel_do_engine/participants/content_modules/index.html.erb +1 -1
  22. data/app/views/think_feel_do_engine/shared/participant/_hamburger_nav_items.html.erb +1 -1
  23. data/app/views/think_feel_do_engine/shared/participant/_nav_items.html.erb +3 -3
  24. data/db/migrate/20160616162347_convert_slide_options.rb +11 -0
  25. data/db/migrate/20160616201120_convert_event_payloads.rb +23 -0
  26. data/lib/tasks/lesson_notifications.rake +1 -1
  27. data/lib/think_feel_do_engine/version.rb +1 -1
  28. metadata +6 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c3b3775063e21d489dcf856ddef6e179cd34e8c2
4
- data.tar.gz: 2ea4750cceba7cd1786b7c3c795dd2f1aaa3201e
3
+ metadata.gz: b3bcad632eb10037be393711c01e5b9c62f00081
4
+ data.tar.gz: dd748908ba0ebf80bc86c672b08674b2cf102445
5
5
  SHA512:
6
- metadata.gz: 12a9befe18ff9028e706a304f6723ae0569f76fb6e1ab5987bc5cc9d309e52383888aebff8b0bea25f87698a784aa2c2ac44209084e0ea1b2981197bd4686226
7
- data.tar.gz: dc32b56ca3eb64cf1184f73cd9330db7daf4ec4b3eb2e108ffadf3724e6064044403018a75949886a8ae10cc0bb02b0bbe08abff26597c342adcbc1efc963312
6
+ metadata.gz: 5a85a6b07d8f54f14325bdfe0e27a39f56bb7fd27f38246136eef69237cb7b94c706f14215332ac280a55290d6bffb43684f46800be6cfb6ba8b25102c7e44bc
7
+ data.tar.gz: 3d34f12e972f003b2a80dc845235fd1356cd92d235a925fa3bce3783081122e4cc1267b68bea2905d8a8c2f7560958b92941925d59227361a6cead68e16a648b
@@ -18,4 +18,4 @@ module ThinkFeelDoEngine
18
18
  end
19
19
  end
20
20
  end
21
- end
21
+ end
@@ -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(:is_not_allowed_in_site)
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
@@ -14,4 +14,4 @@ class RegistrationsController < Devise::RegistrationsController
14
14
  end
15
15
  end
16
16
  # rubocop:enable Lint/UnusedMethodArgument
17
- end
17
+ end
@@ -51,4 +51,4 @@ module ThinkFeelDoEngine
51
51
  pluralize(scheduled_count(activities), "activity")
52
52
  end
53
53
  end
54
- end
54
+ end
@@ -34,4 +34,4 @@ module ThinkFeelDoEngine
34
34
  current_page?(Engine.routes.url_helpers.new_user_password_path)
35
35
  end
36
36
  end
37
- end
37
+ end
@@ -6,4 +6,4 @@ module ThinkFeelDoEngine
6
6
  yield klass.new(options)
7
7
  end
8
8
  end
9
- end
9
+ end
@@ -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.is_viz
21
+ def self.visualization
22
22
  where is_viz: true
23
23
  end
24
24
 
25
- def self.is_not_viz
25
+ def self.non_visualization
26
26
  where is_viz: false
27
27
  end
28
28
 
29
- def self.is_completed
29
+ def self.completed
30
30
  where.not completed_at: nil
31
31
  end
32
32
 
33
- def self.is_not_completed
33
+ def self.not_completed
34
34
  where completed_at: nil
35
35
  end
36
36
 
37
- def self.is_didactic
37
+ def self.didactic
38
38
  where has_didactic_content: true
39
39
  end
40
40
 
41
- def self.is_not_didactic
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.is_terminated_on(date)
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.is_not_terminated_on(date)
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.is_not_viz.is_didactic,
15
- non_didactic_modules: content_modules.is_not_viz.is_not_didactic,
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
- .is_not_terminated_on(Time.zone.today)
38
+ .not_terminated_on(Time.zone.today)
39
39
  .latest_duplicate
40
40
  end
41
41
  end
@@ -129,7 +129,7 @@ class Membership < ActiveRecord::Base
129
129
  end
130
130
 
131
131
  def lessons_read
132
- task_statuses.completed.select(&:is_lesson?)
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(&:is_lesson?)
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(&:is_lesson?)
149
+ .select(&:lesson?)
150
150
  end
151
151
 
152
152
  def withdraw
@@ -95,7 +95,7 @@ class Participant < ActiveRecord::Base
95
95
  where(is_admin: false)
96
96
  }
97
97
 
98
- def is_not_allowed_in_site
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
- task_statuses.collect do |status|
39
- if status.completed_at.nil?
40
- status.participant
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
- task_statuses.collect do |status|
47
- unless status.completed_at.nil?
48
- status.participant
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.where.not(completed_at: nil).count
56
+ task_statuses.non_moderator.completed.count
61
57
  end
62
58
 
63
59
  private
@@ -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 is_lesson?
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: is_message_read?,
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 is_message_read?
96
+ def message_read?
97
97
  received_message.try(:is_read)
98
98
  end
99
99
 
100
100
  def message_read_at
101
- is_message_read? && received_message.try(:updated_at)
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: is_last_module_page(last_event.current_url,
99
- module_id)
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.is_last_module_page(url, module_id)
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
@@ -20,4 +20,4 @@ module ThinkFeelDoEngine
20
20
  end
21
21
  end
22
22
  end
23
- end
23
+ end
@@ -30,18 +30,18 @@ class ToolNavItem
30
30
  !%w(RELAX SUPPORT).include?(tool.title)
31
31
  end
32
32
 
33
- def is_active?(current_module)
33
+ def active?(current_module)
34
34
  current_module.bit_core_tool_id == @tool.id
35
35
  end
36
36
 
37
- def has_subnav?
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
- .is_not_viz
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
- .is_not_viz
53
- .is_not_completed
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
- .is_not_terminated_on(Time.zone.today)
64
+ .not_terminated_on(Time.zone.today)
65
65
  end
66
66
  end
@@ -21,4 +21,4 @@ module Values
21
21
  @label.to_s
22
22
  end
23
23
  end
24
- end
24
+ end
@@ -21,4 +21,4 @@ module Values
21
21
  @label.to_s
22
22
  end
23
23
  end
24
- end
24
+ end
@@ -20,4 +20,4 @@ module Values
20
20
  @label.to_s
21
21
  end
22
22
  end
23
- end
23
+ end
@@ -18,7 +18,7 @@
18
18
  </div>
19
19
  <% end %>
20
20
 
21
- <% content_modules.is_viz.each do |available_module| %>
21
+ <% content_modules.visualization.each do |available_module| %>
22
22
  <br>
23
23
  <%= available_module
24
24
  .content_providers
@@ -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.is_active?(@navigator.current_module) ? " active" : "" %>">
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.has_subnav? %>
5
- <li class="<%= tool_nav.title %> dropdown hidden-xs<%= tool_nav.is_active?(@navigator.current_module) ? " active" : "" %>">
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.is_active?(@navigator.current_module) ? " active" : "" %>">
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,11 @@
1
+ class ConvertSlideOptions < ActiveRecord::Migration
2
+ class MigrationSlide < ActiveRecord::Base
3
+ self.table_name = :bit_core_slides
4
+ end
5
+
6
+ def change
7
+ MigrationSlide.find_each do |slide|
8
+ slide.save!
9
+ end
10
+ end
11
+ end
@@ -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.is_lesson? && task_status.notify_today?
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  # nodoc
3
3
  module ThinkFeelDoEngine
4
- VERSION = "3.20.1"
4
+ VERSION = "3.21.0"
5
5
  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.20.1
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-15 00:00:00.000000000 Z
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.5.1
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: