think_feel_do_engine 3.19.9 → 3.20.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.
Files changed (196) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +11 -3
  3. data/app/assets/config/manifest.js +3 -0
  4. data/app/assets/javascripts/think_feel_do_engine/activities/activity_tracker.js +3 -2
  5. data/app/controllers/think_feel_do_engine/application_controller.rb +4 -3
  6. data/app/controllers/think_feel_do_engine/bit_maker/content_modules_controller.rb +4 -3
  7. data/app/controllers/think_feel_do_engine/bit_maker/content_providers_controller.rb +2 -1
  8. data/app/controllers/think_feel_do_engine/bit_maker/slides_controller.rb +7 -5
  9. data/app/controllers/think_feel_do_engine/bit_maker/slideshow_anchors_controller.rb +3 -2
  10. data/app/controllers/think_feel_do_engine/bit_maker/slideshows_controller.rb +1 -0
  11. data/app/controllers/think_feel_do_engine/coach/group_dashboard_controller.rb +1 -0
  12. data/app/controllers/think_feel_do_engine/coach/memberships_controller.rb +7 -4
  13. data/app/controllers/think_feel_do_engine/coach/messages_controller.rb +2 -1
  14. data/app/controllers/think_feel_do_engine/coach/participant_activities_visualizations_controller.rb +1 -0
  15. data/app/controllers/think_feel_do_engine/coach/participant_thoughts_visualizations_controller.rb +1 -0
  16. data/app/controllers/think_feel_do_engine/coach/patient_dashboards_controller.rb +1 -0
  17. data/app/controllers/think_feel_do_engine/coach/phq_assessments_controller.rb +1 -0
  18. data/app/controllers/think_feel_do_engine/coach/received_messages_controller.rb +2 -1
  19. data/app/controllers/think_feel_do_engine/coach/sent_messages_controller.rb +1 -0
  20. data/app/controllers/think_feel_do_engine/coach/site_messages_controller.rb +1 -0
  21. data/app/controllers/think_feel_do_engine/coach_dashboard_controller.rb +1 -0
  22. data/app/controllers/think_feel_do_engine/concerns/browser_detective.rb +13 -12
  23. data/app/controllers/think_feel_do_engine/concerns/invalid_auth_token.rb +1 -0
  24. data/app/controllers/think_feel_do_engine/concerns/navigator_enabled.rb +1 -0
  25. data/app/controllers/think_feel_do_engine/keep_alive_controller.rb +1 -0
  26. data/app/controllers/think_feel_do_engine/lesson_slides_controller.rb +3 -2
  27. data/app/controllers/think_feel_do_engine/lessons_controller.rb +4 -3
  28. data/app/controllers/think_feel_do_engine/manage/groups_controller.rb +3 -2
  29. data/app/controllers/think_feel_do_engine/manage/tasks_controller.rb +1 -0
  30. data/app/controllers/think_feel_do_engine/memberships_controller.rb +1 -0
  31. data/app/controllers/think_feel_do_engine/navigator_controller.rb +7 -4
  32. data/app/controllers/think_feel_do_engine/participant_data_controller.rb +3 -2
  33. data/app/controllers/think_feel_do_engine/participants/activities_controller.rb +8 -11
  34. data/app/controllers/think_feel_do_engine/participants/assessments_controller.rb +4 -3
  35. data/app/controllers/think_feel_do_engine/participants/lessons_controller.rb +1 -0
  36. data/app/controllers/think_feel_do_engine/participants/media_access_events_controller.rb +3 -3
  37. data/app/controllers/think_feel_do_engine/participants/passwords_controller.rb +1 -0
  38. data/app/controllers/think_feel_do_engine/participants/public_slides_controller.rb +3 -2
  39. data/app/controllers/think_feel_do_engine/participants/sessions_controller.rb +1 -0
  40. data/app/controllers/think_feel_do_engine/participants/thoughts_controller.rb +4 -5
  41. data/app/controllers/think_feel_do_engine/password_entropy_bits_controller.rb +3 -1
  42. data/app/controllers/think_feel_do_engine/privacy_policies_controller.rb +1 -0
  43. data/app/controllers/think_feel_do_engine/quick_sign_ins_controller.rb +1 -0
  44. data/app/controllers/think_feel_do_engine/users/passwords_controller.rb +1 -0
  45. data/app/controllers/think_feel_do_engine/users/registrations_controller.rb +1 -0
  46. data/app/controllers/think_feel_do_engine/users/sessions_controller.rb +1 -0
  47. data/app/helpers/think_feel_do_engine/activities_helper.rb +2 -1
  48. data/app/helpers/think_feel_do_engine/application_helper.rb +2 -1
  49. data/app/helpers/think_feel_do_engine/brand_helper.rb +1 -0
  50. data/app/helpers/think_feel_do_engine/coach/activity_color_code_helper.rb +1 -0
  51. data/app/helpers/think_feel_do_engine/coach/dashboard_and_phq_table_helper.rb +6 -5
  52. data/app/helpers/think_feel_do_engine/coach/group_dashboard_helper.rb +5 -3
  53. data/app/helpers/think_feel_do_engine/coach/messages_helper.rb +3 -1
  54. data/app/helpers/think_feel_do_engine/coach/moods_and_phq_viz_helper.rb +1 -0
  55. data/app/helpers/think_feel_do_engine/coach/patient_dashboard_helper.rb +9 -8
  56. data/app/helpers/think_feel_do_engine/emotions_helper.rb +1 -0
  57. data/app/helpers/think_feel_do_engine/phq_assessment_helper.rb +1 -0
  58. data/app/helpers/think_feel_do_engine/presenters_helper.rb +1 -0
  59. data/app/helpers/think_feel_do_engine/slides_helper.rb +5 -2
  60. data/app/helpers/think_feel_do_engine/tasks_helper.rb +11 -9
  61. data/app/mailers/think_feel_do_engine/lesson_notification_mailer.rb +5 -2
  62. data/app/mailers/think_feel_do_engine/message_notifications.rb +1 -0
  63. data/app/mailers/think_feel_do_engine/site_message_mailer.rb +3 -1
  64. data/app/models/ability.rb +1 -0
  65. data/app/models/activity.rb +21 -10
  66. data/app/models/activity_type.rb +1 -0
  67. data/app/models/arm.rb +2 -2
  68. data/app/models/arm_validator.rb +3 -1
  69. data/app/models/available_content_module.rb +6 -2
  70. data/app/models/awake_period.rb +1 -0
  71. data/app/models/bit_core/slide_observer.rb +1 -0
  72. data/app/models/coach_assignment.rb +1 -0
  73. data/app/models/concerns/accessibility.rb +1 -0
  74. data/app/models/concerns/copier.rb +25 -17
  75. data/app/models/content_modules/lesson_module.rb +6 -5
  76. data/app/models/content_modules.rb +3 -2
  77. data/app/models/content_provider_decorator.rb +1 -0
  78. data/app/models/content_provider_policy.rb +1 -0
  79. data/app/models/content_providers/accomplished_activity_index_provider.rb +1 -0
  80. data/app/models/content_providers/activity_index_provider.rb +1 -0
  81. data/app/models/content_providers/augmented_thoughts_table_provider.rb +1 -0
  82. data/app/models/content_providers/awake_period_form.rb +1 -0
  83. data/app/models/content_providers/create_activity.rb +4 -3
  84. data/app/models/content_providers/edit_past_feel_provider.rb +1 -0
  85. data/app/models/content_providers/evaluate_thoughts_provider.rb +1 -0
  86. data/app/models/content_providers/fun_activity_checklist.rb +5 -4
  87. data/app/models/content_providers/harmful_thoughts_edit_form_provider.rb +1 -0
  88. data/app/models/content_providers/helpful_thoughts_index_provider.rb +1 -0
  89. data/app/models/content_providers/important_activity_checklist.rb +5 -4
  90. data/app/models/content_providers/index_past_feel_provider.rb +1 -0
  91. data/app/models/content_providers/input_new_activity_form.rb +1 -0
  92. data/app/models/content_providers/learn_lessons_index_provider.rb +5 -4
  93. data/app/models/content_providers/messages_index_provider.rb +2 -1
  94. data/app/models/content_providers/module_index_provider.rb +1 -0
  95. data/app/models/content_providers/new_complete_thought_form_provider.rb +1 -0
  96. data/app/models/content_providers/new_current_emotion_provider.rb +1 -0
  97. data/app/models/content_providers/new_current_feel_provider.rb +1 -0
  98. data/app/models/content_providers/new_harmful_thought_form_provider.rb +1 -0
  99. data/app/models/content_providers/new_message_form_provider.rb +1 -0
  100. data/app/models/content_providers/new_past_feel_provider.rb +1 -0
  101. data/app/models/content_providers/new_thought_form_provider.rb +1 -0
  102. data/app/models/content_providers/new_thoughts_form_provider.rb +1 -0
  103. data/app/models/content_providers/past_activity_form.rb +1 -0
  104. data/app/models/content_providers/past_activity_review_form.rb +1 -0
  105. data/app/models/content_providers/past_due_activities_viz.rb +1 -0
  106. data/app/models/content_providers/pleasurable_activity_index_provider.rb +1 -0
  107. data/app/models/content_providers/previous_planned_activities_provider.rb +1 -0
  108. data/app/models/content_providers/random_slide_provider.rb +1 -0
  109. data/app/models/content_providers/show_message_provider.rb +5 -3
  110. data/app/models/content_providers/thought_patterns_index_provider.rb +1 -0
  111. data/app/models/content_providers/thoughts_distortion_viz_provider.rb +1 -0
  112. data/app/models/content_providers/thoughts_table_provider.rb +1 -0
  113. data/app/models/content_providers/unhelpful_thoughts_list_provider.rb +5 -2
  114. data/app/models/content_providers/unhelpful_thoughts_reflection_provider.rb +1 -0
  115. data/app/models/content_providers/unplanned_activity_form.rb +1 -0
  116. data/app/models/content_providers/your_activities_provider.rb +4 -2
  117. data/app/models/delivered_message.rb +3 -1
  118. data/app/models/emotion.rb +3 -2
  119. data/app/models/emotional_rating.rb +1 -0
  120. data/app/models/engagement.rb +1 -0
  121. data/app/models/group.rb +2 -1
  122. data/app/models/group_metrics/weekly_activities_count.rb +1 -0
  123. data/app/models/group_metrics/weekly_comments_count.rb +1 -0
  124. data/app/models/group_metrics/weekly_count.rb +1 -0
  125. data/app/models/group_metrics/weekly_goals_count.rb +1 -0
  126. data/app/models/group_metrics/weekly_likes_count.rb +1 -0
  127. data/app/models/group_metrics/weekly_logins_count.rb +1 -0
  128. data/app/models/group_metrics/weekly_on_the_mind_statements_count.rb +1 -0
  129. data/app/models/group_metrics/weekly_thoughts_count.rb +1 -0
  130. data/app/models/media_access_event.rb +1 -0
  131. data/app/models/membership.rb +5 -3
  132. data/app/models/message.rb +1 -0
  133. data/app/models/message_sms_notification.rb +3 -1
  134. data/app/models/mood.rb +3 -1
  135. data/app/models/participant.rb +2 -1
  136. data/app/models/participant_login_event.rb +1 -0
  137. data/app/models/participant_metrics/weekly_count.rb +1 -0
  138. data/app/models/participant_metrics/weekly_logins_count.rb +1 -0
  139. data/app/models/participant_token.rb +3 -2
  140. data/app/models/phq_assessment.rb +3 -0
  141. data/app/models/phq_stepping.rb +5 -4
  142. data/app/models/phq_stepping_assessment.rb +12 -13
  143. data/app/models/planned_activity.rb +1 -0
  144. data/app/models/roles/clinician.rb +1 -0
  145. data/app/models/roles/content_author.rb +1 -0
  146. data/app/models/roles/researcher.rb +1 -0
  147. data/app/models/site_message.rb +1 -0
  148. data/app/models/slideshow_anchor.rb +2 -1
  149. data/app/models/task.rb +3 -1
  150. data/app/models/task_status.rb +4 -2
  151. data/app/models/think_feel_do_engine/addressable.rb +1 -0
  152. data/app/models/think_feel_do_engine/concerns/validate_password.rb +1 -0
  153. data/app/models/think_feel_do_engine/password_validator.rb +3 -1
  154. data/app/models/think_feel_do_engine/reports/emotional_rating.rb +1 -0
  155. data/app/models/think_feel_do_engine/reports/event.rb +3 -2
  156. data/app/models/think_feel_do_engine/reports/lesson_module.rb +4 -3
  157. data/app/models/think_feel_do_engine/reports/lesson_slide_view.rb +1 -0
  158. data/app/models/think_feel_do_engine/reports/lesson_viewing.rb +9 -8
  159. data/app/models/think_feel_do_engine/reports/login.rb +1 -0
  160. data/app/models/think_feel_do_engine/reports/messaging.rb +2 -1
  161. data/app/models/think_feel_do_engine/reports/module_page_view.rb +1 -0
  162. data/app/models/think_feel_do_engine/reports/module_session.rb +6 -5
  163. data/app/models/think_feel_do_engine/reports/patient_activity.rb +1 -0
  164. data/app/models/think_feel_do_engine/reports/patient_thought.rb +2 -1
  165. data/app/models/think_feel_do_engine/reports/phq_assessment.rb +1 -0
  166. data/app/models/think_feel_do_engine/reports/reporter.rb +2 -1
  167. data/app/models/think_feel_do_engine/reports/site_session.rb +1 -0
  168. data/app/models/think_feel_do_engine/reports/task_completion.rb +3 -2
  169. data/app/models/think_feel_do_engine/reports/tool_access.rb +1 -0
  170. data/app/models/think_feel_do_engine/reports/tool_module.rb +1 -0
  171. data/app/models/think_feel_do_engine/reports/user_agent.rb +1 -0
  172. data/app/models/think_feel_do_engine/reports/video_session.rb +1 -0
  173. data/app/models/think_feel_do_engine/reports/wai_assessment.rb +1 -0
  174. data/app/models/thought.rb +4 -2
  175. data/app/models/thought_pattern.rb +1 -0
  176. data/app/models/tool_nav_item.rb +2 -1
  177. data/app/models/tools/home.rb +1 -0
  178. data/app/models/tools/learn.rb +1 -0
  179. data/app/models/tools/messages.rb +1 -0
  180. data/app/models/tools/think.rb +1 -0
  181. data/app/models/unplanned_activities.rb +2 -2
  182. data/app/models/user.rb +1 -0
  183. data/app/models/user_role.rb +2 -1
  184. data/app/models/values/accomplishment.rb +1 -0
  185. data/app/models/values/emotional_rating.rb +1 -0
  186. data/app/models/values/mood.rb +1 -0
  187. data/app/models/values/pleasure.rb +1 -0
  188. data/app/models/wai_assessment.rb +4 -1
  189. data/app/presenters/think_feel_do_engine/harmful_thought_viz_presenter.rb +1 -0
  190. data/app/presenters/think_feel_do_engine/lesson_event/completion_data_presenter.rb +1 -0
  191. data/app/presenters/think_feel_do_engine/media_access_event_presenter.rb +1 -0
  192. data/app/support/mood_and_emotion_visualization_service.rb +22 -25
  193. data/lib/think_feel_do_engine/engine.rb +1 -0
  194. data/lib/think_feel_do_engine/version.rb +2 -1
  195. data/lib/think_feel_do_engine.rb +1 -0
  196. metadata +20 -6
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_dependency "think_feel_do_engine/application_controller"
2
3
 
3
4
  module ThinkFeelDoEngine
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require_dependency "think_feel_do_engine/application_controller"
2
3
 
3
4
  module ThinkFeelDoEngine
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ThinkFeelDoEngine
2
3
  module Users
3
4
  # Customize User password actions.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Overridden methods for the registrations controller of Devise
2
3
  class RegistrationsController < Devise::RegistrationsController
3
4
  skip_authorization_check
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ThinkFeelDoEngine
2
3
  module Users
3
4
  # Extends the Devise controller to notify users
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ThinkFeelDoEngine
2
3
  # Used to the average in difference between the actual
3
4
  # and predicted values of a collection of activities
@@ -35,7 +36,7 @@ module ThinkFeelDoEngine
35
36
  def percent_complete(activities)
36
37
  if activities.were_planned.count > 0
37
38
  (activities.reviewed_and_complete.count.to_f /
38
- (activities.were_planned.count).to_f * 100
39
+ activities.were_planned.count.to_f * 100
39
40
  ).round(0).to_s + "%"
40
41
  else
41
42
  "Not Available"
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ThinkFeelDoEngine
2
3
  # Ensure font awesome icon helpers are available.
3
4
  module ApplicationHelper
@@ -5,7 +6,7 @@ module ThinkFeelDoEngine
5
6
 
6
7
  def host_email_link
7
8
  host_url = Rails.application.config.action_mailer
8
- .default_url_options[:host]
9
+ .default_url_options[:host]
9
10
  host_url if host_url
10
11
  end
11
12
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ThinkFeelDoEngine
2
3
  # Brand logo navigation helper methods
3
4
  module BrandHelper
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ThinkFeelDoEngine
2
3
  module Coach
3
4
  # Provides helpers for color coding activities
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ThinkFeelDoEngine
2
3
  module Coach
3
4
  # Provides helpers for patient dashboard index and phq9 table
@@ -42,11 +43,11 @@ module ThinkFeelDoEngine
42
43
  end
43
44
 
44
45
  def reverse_label_styling(string, na_condition, tf_condition)
45
- if tf_condition
46
- string = "danger label-adj_danger"
47
- else
48
- string = "success label-adj_success"
49
- end
46
+ string = if tf_condition
47
+ "danger label-adj_danger"
48
+ else
49
+ "success label-adj_success"
50
+ end
50
51
  string = "warning" if na_condition || tf_condition.nil?
51
52
  string
52
53
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ThinkFeelDoEngine
2
3
  module Coach
3
4
  # Displays navigational information in the form of breadcrumbs
@@ -69,9 +70,10 @@ module ThinkFeelDoEngine
69
70
  participant_list = "<ul>"
70
71
  participants.each do |participant|
71
72
  participant_list +=
72
- "<li>#{link_to participant.display_name,
73
- coach_group_patient_dashboard_path(
74
- group, participant)}</li>" if participant
73
+ "<li>#{link_to participant.display_name,
74
+ coach_group_patient_dashboard_path(
75
+ group, participant
76
+ )}</li>" if participant
75
77
  end
76
78
  participant_list += "</ul>"
77
79
  participant_list
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ThinkFeelDoEngine
2
3
  module Coach
3
4
  # Provides helpers for coach message composition.
@@ -19,7 +20,8 @@ module ThinkFeelDoEngine
19
20
 
20
21
  def insert_intro_slideshow_anchor(options)
21
22
  if (slideshow = SlideshowAnchor.fetch(:home_intro))
22
- path = ThinkFeelDoEngine::Engine.routes.url_helpers
23
+ path = ThinkFeelDoEngine::Engine
24
+ .routes.url_helpers
23
25
  .participants_public_slideshow_slide_path(
24
26
  slideshow_id: slideshow.id,
25
27
  id: slideshow.slides.first.id
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ThinkFeelDoEngine
2
3
  module Coach
3
4
  # Provides helpers for transforming patient data for the viz
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ThinkFeelDoEngine
2
3
  module Coach
3
4
  # Displays navigational information in the form of breadcrumbs
@@ -5,7 +6,7 @@ module ThinkFeelDoEngine
5
6
  VISUALIZATION_CONTROLLERS = [
6
7
  "participant_activities_visualizations",
7
8
  "participant_thoughts_visualizations"
8
- ]
9
+ ].freeze
9
10
 
10
11
  def breadcrumbs
11
12
  return unless VISUALIZATION_CONTROLLERS.include?(controller_name)
@@ -32,20 +33,20 @@ module ThinkFeelDoEngine
32
33
  participant
33
34
  .activities.planned.created_for_day(Time.zone.today).count +
34
35
  participant
35
- .activities
36
- .reviewed_and_complete.created_for_day(Time.zone.today).count +
36
+ .activities
37
+ .reviewed_and_complete.created_for_day(Time.zone.today).count +
37
38
  participant
38
- .activities
39
- .reviewed_and_incomplete.created_for_day(Time.zone.today).count
39
+ .activities
40
+ .reviewed_and_incomplete.created_for_day(Time.zone.today).count
40
41
  end
41
42
 
42
43
  def activities_planned_7_day(participant)
43
44
  participant.activities
44
- .planned.created_last_seven_days.count +
45
+ .planned.created_last_seven_days.count +
45
46
  participant.activities
46
- .reviewed_and_complete.created_last_seven_days.count +
47
+ .reviewed_and_complete.created_last_seven_days.count +
47
48
  participant.activities
48
- .reviewed_and_incomplete.created_last_seven_days.count
49
+ .reviewed_and_incomplete.created_last_seven_days.count
49
50
  end
50
51
 
51
52
  def activities_planned_total(participant)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ThinkFeelDoEngine
2
3
  # Used to change color of table row based on emotion
3
4
  module EmotionsHelper
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ThinkFeelDoEngine
2
3
  # Used to display a warning message to clinicians if
3
4
  # a user scores a 3 on a the PHQ-9
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ThinkFeelDoEngine
2
3
  # Used to present a presenter classes within a view.
3
4
  module PresentersHelper
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ThinkFeelDoEngine
2
3
  # Provides helpers for slide creation.
3
4
  module SlidesHelper
@@ -8,13 +9,15 @@ module ThinkFeelDoEngine
8
9
  link_to "Destroy Table of Contents",
9
10
  arm_bit_maker_slideshow_destroy_table_of_contents_path(
10
11
  arm,
11
- slideshow),
12
+ slideshow
13
+ ),
12
14
  class: "btn btn-default toc"
13
15
  else
14
16
  link_to "Add Table of Contents",
15
17
  arm_bit_maker_slideshow_create_table_of_contents_path(
16
18
  arm,
17
- slideshow),
19
+ slideshow
20
+ ),
18
21
  class: "btn btn-default toc"
19
22
  end
20
23
  end
@@ -1,12 +1,13 @@
1
+ # frozen_string_literal: true
1
2
  module ThinkFeelDoEngine
2
3
  # Used to display asterisks if tasks and tools have been assigned to a group
3
4
  # and to hide unassigned links
4
5
  module TasksHelper
5
6
  def task_status(membership, content_module)
6
7
  membership.available_task_statuses
7
- .for_content_module(content_module)
8
- .order(start_day: :asc)
9
- .last
8
+ .for_content_module(content_module)
9
+ .order(start_day: :asc)
10
+ .last
10
11
  end
11
12
 
12
13
  def task_status_viz(task_status)
@@ -17,7 +18,8 @@ module ThinkFeelDoEngine
17
18
  available_module = TaskStatusLink.new(
18
19
  available_module: available_module,
19
20
  icon: icon,
20
- membership: membership)
21
+ membership: membership
22
+ )
21
23
  link_to available_module.name,
22
24
  think_feel_do_engine.navigator_location_path(
23
25
  module_id: available_module.id
@@ -43,7 +45,7 @@ module ThinkFeelDoEngine
43
45
  # If the TaskStatus was *just* marked complete, this is the first time
44
46
  # viewing the ContentProvider, so we should consider it incomplete.
45
47
  ContentProviderDecorator.fetch(provider)
46
- .is_skippable_after_first_viewing &&
48
+ .is_skippable_after_first_viewing &&
47
49
  task_status(membership, mod).completed_at < Time.current - 5.minutes
48
50
  end
49
51
 
@@ -97,10 +99,10 @@ module ThinkFeelDoEngine
97
99
 
98
100
  def completed?
99
101
  membership.available_task_statuses
100
- .for_content_module(available_module)
101
- .order(start_day: :asc)
102
- .last
103
- .try(:completed_at)
102
+ .for_content_module(available_module)
103
+ .order(start_day: :asc)
104
+ .last
105
+ .try(:completed_at)
104
106
  end
105
107
 
106
108
  def completion_status
@@ -1,11 +1,14 @@
1
+ # frozen_string_literal: true
1
2
  module ThinkFeelDoEngine
2
3
  # Sends a new lesson notification to a given participant.
3
4
  class LessonNotificationMailer < ActionMailer::Base
4
5
  default(
5
- from: Rails.configuration.action_mailer.default_options[:from])
6
+ from: Rails.configuration.action_mailer.default_options[:from]
7
+ )
6
8
 
7
9
  def lesson_notification_email(
8
- application_name:, lesson_module:, participant_email:)
10
+ application_name:, lesson_module:, participant_email:
11
+ )
9
12
  @application_name = application_name
10
13
  @lesson = lesson_module
11
14
  mail(to: participant_email,
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ThinkFeelDoEngine
2
3
  # Mailer for notifying of new application messages.
3
4
  class MessageNotifications < ActionMailer::Base
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
1
2
  module ThinkFeelDoEngine
2
3
  # Mailer for SiteMessage delivery.
3
4
  class SiteMessageMailer < ActionMailer::Base
4
5
  def general(message)
5
6
  markdown = Redcarpet::Markdown.new(
6
7
  Redcarpet::Render::HTML,
7
- space_after_headers: true)
8
+ space_after_headers: true
9
+ )
8
10
  @body = markdown.render(message.body)
9
11
 
10
12
  mail to: message.participant.email,
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Uses CanCan to assign granular authorizations.
2
3
  class Ability
3
4
  include CanCan::Ability
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Represents a real-world activity of a participant.
2
3
  class Activity < ActiveRecord::Base
3
4
  attr_accessor :activity_type_title,
@@ -96,18 +97,21 @@ class Activity < ActiveRecord::Base
96
97
  predicted_accomplishment_intensity: nil,
97
98
  predicted_pleasure_intensity: nil,
98
99
  actual_accomplishment_intensity: nil,
99
- actual_pleasure_intensity: nil)
100
+ actual_pleasure_intensity: nil
101
+ )
100
102
  }
101
103
 
102
104
  scope :reviewed_and_incomplete, lambda {
103
105
  where(is_reviewed: true)
104
106
  .where(
105
107
  actual_accomplishment_intensity: nil,
106
- actual_pleasure_intensity: nil)
108
+ actual_pleasure_intensity: nil
109
+ )
107
110
  .where
108
111
  .not(
109
112
  predicted_accomplishment_intensity: nil,
110
- predicted_pleasure_intensity: nil)
113
+ predicted_pleasure_intensity: nil
114
+ )
111
115
  }
112
116
 
113
117
  scope :monitored, lambda {
@@ -115,10 +119,12 @@ class Activity < ActiveRecord::Base
115
119
  .where
116
120
  .not(
117
121
  actual_accomplishment_intensity: nil,
118
- actual_pleasure_intensity: nil)
122
+ actual_pleasure_intensity: nil
123
+ )
119
124
  .where(
120
125
  predicted_accomplishment_intensity: nil,
121
- predicted_pleasure_intensity: nil)
126
+ predicted_pleasure_intensity: nil
127
+ )
122
128
  }
123
129
 
124
130
  # To Do: fix naming and/or what is going on here
@@ -134,11 +140,13 @@ class Activity < ActiveRecord::Base
134
140
  where(
135
141
  is_reviewed: false,
136
142
  actual_accomplishment_intensity: nil,
137
- actual_pleasure_intensity: nil)
143
+ actual_pleasure_intensity: nil
144
+ )
138
145
  .where
139
146
  .not(
140
147
  predicted_accomplishment_intensity: nil,
141
- predicted_pleasure_intensity: nil)
148
+ predicted_pleasure_intensity: nil
149
+ )
142
150
  }
143
151
 
144
152
  scope :random, lambda {
@@ -149,14 +157,16 @@ class Activity < ActiveRecord::Base
149
157
  where
150
158
  .not(
151
159
  predicted_accomplishment_intensity: nil,
152
- predicted_pleasure_intensity: nil)
160
+ predicted_pleasure_intensity: nil
161
+ )
153
162
  }
154
163
 
155
164
  scope :with_actual_ratings, lambda {
156
165
  where
157
166
  .not(
158
167
  actual_accomplishment_intensity: nil,
159
- actual_pleasure_intensity: nil)
168
+ actual_pleasure_intensity: nil
169
+ )
160
170
  }
161
171
 
162
172
  scope :unplanned, lambda {
@@ -182,7 +192,8 @@ class Activity < ActiveRecord::Base
182
192
  def update_as_reviewed(params = {})
183
193
  update(
184
194
  params
185
- .merge(in_review: true, is_reviewed: true))
195
+ .merge(in_review: true, is_reviewed: true)
196
+ )
186
197
  end
187
198
 
188
199
  def actual_ratings!
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # The name given to an Activity. Can be private to a Participant or public.
2
3
  class ActivityType < ActiveRecord::Base
3
4
  belongs_to :participant
data/app/models/arm.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # These arms are part of the adolescent and adult projects
2
3
  # Between 1 and 8 groups are in each arm and each group
3
4
  # could have between 1 and 10 or so participants
@@ -41,7 +42,6 @@ class Arm < ActiveRecord::Base
41
42
  tools = BitCore::Tool.arel_table
42
43
  bit_core_tools
43
44
  .where(tools[:type].eq(nil)
44
- .or(tools[:type].not_eq("Tools::Home"))
45
- )
45
+ .or(tools[:type].not_eq("Tools::Home")))
46
46
  end
47
47
  end
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
1
2
  # Validates Arm model.
2
3
  class ArmValidator < ActiveModel::Validator
3
4
  def validate(record)
4
- if ActiveRecord::Base.connection
5
+ if ActiveRecord::Base
6
+ .connection
5
7
  .column_exists?(:arms, :can_message_after_membership_complete) &&
6
8
  record.can_message_after_membership_complete.nil?
7
9
  record.errors[:base] << "An Arm must have a value for can_message"\
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # A read-only, view backed model that represents an assigned Content Module.
2
3
  class AvailableContentModule < ActiveRecord::Base
3
4
  self.primary_key = :id
@@ -52,7 +53,9 @@ class AvailableContentModule < ActiveRecord::Base
52
53
  .lt(membership_start_date + study_week_number.weeks)
53
54
  .and(
54
55
  available_on
55
- .gteq(membership_start_date + (study_week_number - 1).weeks)))
56
+ .gteq(membership_start_date + (study_week_number - 1).weeks)
57
+ )
58
+ )
56
59
  end
57
60
 
58
61
  def self.is_terminated_on(date)
@@ -63,7 +66,8 @@ class AvailableContentModule < ActiveRecord::Base
63
66
  for_participant(membership.participant)
64
67
  .where(
65
68
  arel_table[:available_on]
66
- .lt(membership.start_date + (membership.week_in_study - 1).weeks))
69
+ .lt(membership.start_date + (membership.week_in_study - 1).weeks)
70
+ )
67
71
  end
68
72
 
69
73
  def self.is_not_terminated_on(date)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # A period of time during which a Participant was awake and may have
2
3
  # participated in Activities.
3
4
  class AwakePeriod < ActiveRecord::Base
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module BitCore
2
3
  # Listen for BitCore::Slide lifecycle events.
3
4
  # Registered in config/application.rb
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # The assignment of a Coach (User) to a Participant.
2
3
  class CoachAssignment < ActiveRecord::Base
3
4
  belongs_to :participant
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Concerns
2
3
  # Determines whether a participant can access a lesson
3
4
  module Accessibility
@@ -16,10 +16,12 @@ module Concerns
16
16
  .create!(
17
17
  position: new_tools.count,
18
18
  title: tool.title,
19
- type: tool.type)
19
+ type: tool.type
20
+ )
20
21
 
21
22
  tool.copy_all_to(
22
- new_tool: new_tool)
23
+ new_tool: new_tool
24
+ )
23
25
  end
24
26
  end
25
27
 
@@ -29,14 +31,16 @@ module Concerns
29
31
  new_tools.create!(
30
32
  position: new_tools.count,
31
33
  title: TOOL_TITLE,
32
- type: LEARN_TOOL)
34
+ type: LEARN_TOOL
35
+ )
33
36
 
34
37
  return unless new_tool
35
38
 
36
39
  bit_core_tools
37
40
  .find_by(type: LEARN_TOOL)
38
41
  .copy_content_modules_to(
39
- new_tool: new_tool)
42
+ new_tool: new_tool
43
+ )
40
44
  end
41
45
  end
42
46
 
@@ -48,7 +52,8 @@ module Concerns
48
52
  ContentModule.transaction do
49
53
  content_modules.each do |content_module|
50
54
  content_module.copy_content_providers_to(
51
- new_tool: new_tool)
55
+ new_tool: new_tool
56
+ )
52
57
  end
53
58
  end
54
59
  end
@@ -56,9 +61,10 @@ module Concerns
56
61
  def copy_content_modules_to(new_tool:)
57
62
  ContentModule.transaction do
58
63
  content_modules.where(type: LESSON_MODULE)
59
- .find_each do |content_module|
64
+ .find_each do |content_module|
60
65
  content_module.copy_content_providers_to(
61
- new_tool: new_tool)
66
+ new_tool: new_tool
67
+ )
62
68
  end
63
69
  end
64
70
  end
@@ -72,7 +78,8 @@ module Concerns
72
78
  position: position,
73
79
  title: title,
74
80
  tool: new_tool,
75
- type: type)
81
+ type: type
82
+ )
76
83
 
77
84
  new_content_module.content_providers.destroy_all
78
85
 
@@ -80,7 +87,8 @@ module Concerns
80
87
  content_provider
81
88
  .copy_source_content_to!(
82
89
  new_arm: new_tool.arm,
83
- new_content_module: new_content_module)
90
+ new_content_module: new_content_module
91
+ )
84
92
  end
85
93
 
86
94
  new_content_module
@@ -96,7 +104,8 @@ module Concerns
96
104
  position: position,
97
105
  show_next_nav: show_next_nav,
98
106
  type: type,
99
- source_content: source_content.try(:copy_to, new_arm))
107
+ source_content: source_content.try(:copy_to, new_arm)
108
+ )
100
109
  end
101
110
  end
102
111
  end
@@ -126,13 +135,12 @@ module Concerns
126
135
  Slide.class_eval do
127
136
  def copy_to!(slideshow)
128
137
  slideshow.slides
129
- .find_or_create_by!(
130
- body: body,
131
- is_title_visible: is_title_visible,
132
- position: position,
133
- title: title,
134
- type: type)
135
- .update_attributes!(options: options)
138
+ .find_or_create_by!(body: body,
139
+ is_title_visible: is_title_visible,
140
+ position: position,
141
+ title: title,
142
+ type: type)
143
+ .update_attributes!(options: options)
136
144
  end
137
145
  end
138
146
  end
@@ -1,15 +1,16 @@
1
+ # frozen_string_literal: true
1
2
  module ContentModules
2
3
  # Container for didactic content.
3
4
  class LessonModule < BitCore::ContentModule
4
- SLIDESHOW_PROVIDER_TYPE = "BitCore::ContentProviders::SlideshowProvider"
5
+ SLIDESHOW_PROVIDER_TYPE = BitCore::ContentProviders::SlideshowProvider.to_s
5
6
  after_save :update_slideshow
6
7
 
7
8
  def self.sort(arm_id, lesson_ids)
8
9
  start_position = Arm.find(arm_id)
9
- .bit_core_tools.find_by_type("Tools::Learn")
10
- .content_modules
11
- .where(type: [nil, "BitCore::ContentModule"])
12
- .order(position: :asc).maximum(:position)
10
+ .bit_core_tools.find_by_type("Tools::Learn")
11
+ .content_modules
12
+ .where(type: [nil, "BitCore::ContentModule"])
13
+ .order(position: :asc).maximum(:position)
13
14
  start_position ||= 1
14
15
  start_position += 1
15
16
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentModules
2
3
  # Methods for extending BitCore::ContentModule with scopes.
3
4
  module Scopes
@@ -14,8 +15,8 @@ module ContentModules
14
15
  def non_didactic(group_id)
15
16
  non_didactic_module_ids = Task.where(group_id: group_id,
16
17
  has_didactic_content: false)
17
- .select(:id, :bit_core_content_module_id)
18
- .map(&:bit_core_content_module_id)
18
+ .select(:id, :bit_core_content_module_id)
19
+ .map(&:bit_core_content_module_id)
19
20
 
20
21
  where(id: non_viz_module_ids & non_didactic_module_ids).select(:id)
21
22
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Allows for extending BitCore::ContentProvider with an additional model class
2
3
  # and corresponding attributes.
3
4
  class ContentProviderDecorator
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Extends BitCore::ContentProvider with additional properties.
2
3
  class ContentProviderPolicy < ActiveRecord::Base
3
4
  belongs_to :content_provider,
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides a view of completed Activities during the Participant"s most
3
4
  # recent AwakePeriod.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides a view of Activities that occured during a Participant's most
3
4
  # recent AwakePeriod.