think_feel_do_engine 3.19.9 → 3.20.1

Sign up to get free protection for your applications and to get access to all the features.
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
  module ContentProviders
2
3
  # Provides a form for a Participant to enter a Thought.
3
4
  class AugmentedThoughtsTableProvider < BitCore::ContentProvider
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides a form for a Participant to enter the most recent AwakePeriod.
3
4
  class AwakePeriodForm < BitCore::ContentProvider
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides a form for a Participant to schedule new Activities that have
3
4
  # been fun in the past.
@@ -34,9 +35,9 @@ module ContentProviders
34
35
 
35
36
  def activities(participant)
36
37
  participant.activities
37
- .random
38
- .in_the_past
39
- .first(5)
38
+ .random
39
+ .in_the_past
40
+ .first(5)
40
41
  end
41
42
  end
42
43
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Legacy; not used
3
4
  class EditPastFeelProvider < BitCore::ContentProvider
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides a graphic helps patients understand how they can
3
4
  # evaluate their thoughts for accuracy - challenge their thoughts
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides a form for a Participant to schedule new Activities that have
3
4
  # been fun in the past.
@@ -34,10 +35,10 @@ module ContentProviders
34
35
 
35
36
  def activities(participant)
36
37
  participant.activities
37
- .pleasurable
38
- .random
39
- .in_the_past
40
- .first(5)
38
+ .pleasurable
39
+ .random
40
+ .in_the_past
41
+ .first(5)
41
42
  end
42
43
  end
43
44
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides a form for a Participant to identify harmful Thoughts by their
3
4
  # ThoughtPatterns.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides a list of a Participant"s helpful Thoughts.
3
4
  class HelpfulThoughtsIndexProvider < BitCore::ContentProvider
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides a checklist of a random set of Activities for a Participant to
3
4
  # plan.
@@ -35,10 +36,10 @@ module ContentProviders
35
36
 
36
37
  def activities(participant)
37
38
  participant.activities
38
- .accomplished
39
- .random
40
- .in_the_past
41
- .first(5)
39
+ .accomplished
40
+ .random
41
+ .in_the_past
42
+ .first(5)
42
43
  end
43
44
  end
44
45
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Displays all feelings the participant has had in the past
3
4
  class IndexPastFeelProvider < BitCore::ContentProvider
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides a form for a Participant to plan a new Activity.
3
4
  class InputNewActivityForm < BitCore::ContentProvider
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides a view of current learning tools: videos and lessons
3
4
  class LearnLessonsIndexProvider < BitCore::ContentProvider
@@ -26,8 +27,8 @@ module ContentProviders
26
27
 
27
28
  def weekly_tasks(participant, membership, app_context)
28
29
  all_tasks = participant.learning_tasks(content_modules(app_context))
29
- .includes(task: :bit_core_content_module)
30
- .order("bit_core_content_modules.position")
30
+ .includes(task: :bit_core_content_module)
31
+ .order("bit_core_content_modules.position")
31
32
 
32
33
  (1..week_count).map do |week|
33
34
  {
@@ -44,8 +45,8 @@ module ContentProviders
44
45
 
45
46
  def content_modules(app_context)
46
47
  ContentModules::LessonModule.joins(:tool)
47
- .where("bit_core_tools.title" => app_context)
48
- .where.not(id: bit_core_content_module_id)
48
+ .where("bit_core_tools.title" => app_context)
49
+ .where.not(id: bit_core_content_module_id)
49
50
  end
50
51
 
51
52
  def week_count
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides a UI for viewing sent and received Messages.
3
4
  class MessagesIndexProvider < BitCore::ContentProvider
@@ -58,7 +59,7 @@ module ContentProviders
58
59
 
59
60
  def received_messages(participant)
60
61
  participant.received_messages.joins(:message)
61
- .order("messages.sent_at DESC")
62
+ .order("messages.sent_at DESC")
62
63
  end
63
64
  end
64
65
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides a set of links to ContentModules in the current context.
3
4
  class ModuleIndexProvider < BitCore::ContentProvider
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides a form for a Participant to enter a Thought.
3
4
  class NewCompleteThoughtFormProvider < BitCore::ContentProvider
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Participant rates their current mood
3
4
  class NewCurrentEmotionProvider < BitCore::ContentProvider
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Participant rates their current mood
3
4
  class NewCurrentFeelProvider < BitCore::ContentProvider
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides a form for a Participant to enter a Thought.
3
4
  class NewHarmfulThoughtFormProvider < BitCore::ContentProvider
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides a form for a Participant to compose a new Message.
3
4
  class NewMessageFormProvider < BitCore::ContentProvider
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Allows user to submit a mood from the past 24 hours.
3
4
  class NewPastFeelProvider < BitCore::ContentProvider
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides a form for a Participant to enter a Thought.
3
4
  class NewThoughtFormProvider < BitCore::ContentProvider
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides multiple forms for a Participant to enter Thoughts.
3
4
  class NewThoughtsFormProvider < BitCore::ContentProvider
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides multiple forms for a Participant to enter past Activities.
3
4
  class PastActivityForm < BitCore::ContentProvider
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides a form for a Participant to update previously planned Activities.
3
4
  class PastActivityReviewForm < BitCore::ContentProvider
@@ -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.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides a display of recent pleasurable Activities.
3
4
  class PleasurableActivityIndexProvider < BitCore::ContentProvider
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides a form for a Participant to update previously planned Activities.
3
4
  class PreviousPlannedActivitiesProvider < BitCore::ContentProvider
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Selects a random slide from a slideshow to display.
3
4
  class RandomSlideProvider < BitCore::ContentProvider
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides a view of a sent or received Message.
3
4
  class ShowMessageProvider < BitCore::ContentProvider
@@ -25,7 +26,8 @@ module ContentProviders
25
26
  )
26
27
  else
27
28
  options.view_context.render(
28
- template: "think_feel_do_engine/messages/not_found")
29
+ template: "think_feel_do_engine/messages/not_found"
30
+ )
29
31
  end
30
32
  end
31
33
 
@@ -51,10 +53,10 @@ module ContentProviders
51
53
 
52
54
  received_message =
53
55
  participant.received_messages
54
- .find_by(message_id: view_context.params[:message_id])
56
+ .find_by(message_id: view_context.params[:message_id])
55
57
  sent_message =
56
58
  participant.messages
57
- .find_by(id: view_context.params[:message_id])
59
+ .find_by(id: view_context.params[:message_id])
58
60
 
59
61
  received_message || sent_message
60
62
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides a list of all ThoughtPatterns.
3
4
  class ThoughtPatternsIndexProvider < BitCore::ContentProvider
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides a form for a Participant to enter a Thought.
3
4
  class ThoughtsDistortionVizProvider < BitCore::ContentProvider
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides a form for a Participant to enter a Thought.
3
4
  class ThoughtsTableProvider < BitCore::ContentProvider
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides a list of a Participant's unhelpful Thoughts.
3
4
  class UnhelpfulThoughtsListProvider < BitCore::ContentProvider
@@ -56,11 +57,13 @@ module ContentProviders
56
57
  "#{@view.link_to(
57
58
  title_1,
58
59
  @view.navigator_location_path(module_id: module_1.id),
59
- style: 'font-size: larger;')} or use " \
60
+ style: 'font-size: larger;'
61
+ )} or use " \
60
62
  "#{@view.link_to(
61
63
  title_2,
62
64
  @view.navigator_location_path(module_id: module_2.id),
63
- style: 'font-size: larger;')} to do multiple steps at once."
65
+ style: 'font-size: larger;'
66
+ )} to do multiple steps at once."
64
67
  else
65
68
  report_missing_module
66
69
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides a set of forms to update a Participant's unhelpful Thoughts.
3
4
  class UnhelpfulThoughtsReflectionProvider < BitCore::ContentProvider
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Provides forms for a Provider to plan Activities.
3
4
  class UnplannedActivityForm < BitCore::ContentProvider
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ContentProviders
2
3
  # Visualizations of participant activities.
3
4
  class YourActivitiesProvider < BitCore::ContentProvider
@@ -12,7 +13,7 @@ module ContentProviders
12
13
  negative_emotions: negative_emotions(options),
13
14
  positive_emotions: positive_emotions(options),
14
15
  with_actual_ratings: with_actual_ratings(options),
15
- dates_with_activities: collect_dates_with_activities(options)
16
+ dates_with_activities: collect_dates_with_activities(options)
16
17
  }
17
18
  )
18
19
  end
@@ -78,7 +79,8 @@ module ContentProviders
78
79
 
79
80
  # dates with scheduled activities formatted for jquery datepicker
80
81
  def collect_dates_with_activities(options)
81
- past_activities(options).where("start_time <= ?", Time.zone.now)
82
+ past_activities(options)
83
+ .where("start_time <= ?", Time.zone.now)
82
84
  .uniq
83
85
  .map { |activity| activity.start_time.to_date.strftime("%Y-%m-%d") }
84
86
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # An instance of a Message sent to a Participant or User.
2
3
  class DeliveredMessage < ActiveRecord::Base
3
4
  include ThinkFeelDoEngine::Addressable
@@ -37,7 +38,8 @@ class DeliveredMessage < ActiveRecord::Base
37
38
  MessageSmsNotification
38
39
  .new(
39
40
  body: "You have a new #{application_name} message.",
40
- phone_number: recipient.phone_number)
41
+ phone_number: recipient.phone_number
42
+ )
41
43
  .deliver
42
44
  else
43
45
  ThinkFeelDoEngine::MessageNotifications
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Participants rate their emotions a name and intensity
2
3
  class Emotion < ActiveRecord::Base
3
4
  belongs_to :creator, class_name: "Participant"
@@ -17,12 +18,12 @@ class Emotion < ActiveRecord::Base
17
18
  )
18
19
  end
19
20
 
20
- private
21
-
22
21
  def self.normalized_name(n)
23
22
  n.strip.downcase
24
23
  end
25
24
 
25
+ private
26
+
26
27
  def normalize_name
27
28
  if name.respond_to?(:strip)
28
29
  self.name = self.class.normalized_name(name)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Participants no longer rate their emotions, they rate emotional ratings
2
3
  # These are objects tied to emotions - giving participants the opportunity
3
4
  # to rate the same emotion multiple times.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Used to determine when a patient starts and completes learn task_statuses
2
3
  class Engagement < ActiveRecord::Base
3
4
  belongs_to :task_status
data/app/models/group.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # A set of Participants.
2
3
  class Group < ActiveRecord::Base
3
4
  belongs_to :arm
@@ -30,6 +31,6 @@ class Group < ActiveRecord::Base
30
31
 
31
32
  def non_moderator_memberships
32
33
  memberships.joins(:participant)
33
- .merge(Participant.not_moderator)
34
+ .merge(Participant.not_moderator)
34
35
  end
35
36
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GroupMetrics
2
3
  # Tabulate count of Activities (within a study week) for a Group.
3
4
  class WeeklyActivitiesCount < WeeklyCount
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GroupMetrics
2
3
  # Tabulate count of Comments within a study week for a Group.
3
4
  class WeeklyCommentsCount < WeeklyCount
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GroupMetrics
2
3
  # Tabulate count of records (within a study week) for a Group.
3
4
  class WeeklyCount < ActiveRecord::Base
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GroupMetrics
2
3
  # Tabulate count of Goals within a study week for a Group.
3
4
  class WeeklyGoalsCount < WeeklyCount
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GroupMetrics
2
3
  # Tabulate count of Likes within a study week for a Group.
3
4
  class WeeklyLikesCount < WeeklyCount
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GroupMetrics
2
3
  # Tabulate count of Logins (within a study week) for a Group.
3
4
  class WeeklyLoginsCount < WeeklyCount
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GroupMetrics
2
3
  # Tabulate count of OnTheMindStatements within a study week for a Group.
3
4
  class WeeklyOnTheMindStatementsCount < WeeklyCount
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GroupMetrics
2
3
  # Tabulate count of Thoughts (within a study week) for a Group.
3
4
  class WeeklyThoughtsCount < WeeklyCount
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Log of participant viewings and listenings of media slides
2
3
  class MediaAccessEvent < ActiveRecord::Base
3
4
  belongs_to :participant,
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # The relationship of a Participant to a Group.
2
3
  class Membership < ActiveRecord::Base
3
4
  AMERICAN_DATE_FMT = "%m/%d/%Y"
@@ -178,9 +179,10 @@ class Membership < ActiveRecord::Base
178
179
 
179
180
  def single_active_membership
180
181
  if Membership.where(participant_id: participant_id)
181
- .where("start_date <= ? AND end_date >= ?", end_date, start_date)
182
- .where.not(id: id)
183
- .exists?
182
+ .where("start_date <= ? AND end_date >= ?",
183
+ end_date, start_date)
184
+ .where.not(id: id)
185
+ .exists?
184
186
  errors.add(:base, "There can be only one active membership")
185
187
  end
186
188
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # A message sent from a Participant or User to a Participant or User.
2
3
  class Message < ActiveRecord::Base
3
4
  include ThinkFeelDoEngine::Addressable
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # SMS notification service for Messages and Notifications sent to Participants.
2
3
  class MessageSmsNotification
3
4
  attr_reader :body, :phone_number
@@ -50,6 +51,7 @@ class MessageSmsNotification
50
51
  def sms_client
51
52
  @sms_client ||= Twilio::REST::Client.new(
52
53
  config.twilio_account_sid,
53
- config.twilio_auth_token)
54
+ config.twilio_auth_token
55
+ )
54
56
  end
55
57
  end
data/app/models/mood.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Participants rate their mood
2
3
  class Mood < ActiveRecord::Base
3
4
  belongs_to :participant
@@ -18,7 +19,8 @@ class Mood < ActiveRecord::Base
18
19
  scope :last_seven_days, lambda {
19
20
  where(
20
21
  arel_table[:created_at]
21
- .gteq(Time.current.advance(days: -7).beginning_of_day))
22
+ .gteq(Time.current.advance(days: -7).beginning_of_day)
23
+ )
22
24
  }
23
25
 
24
26
  scope :for_day, lambda { |time|
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require "devise"
2
3
 
3
4
  # A person enrolled in the intervention.
@@ -194,7 +195,7 @@ class Participant < ActiveRecord::Base
194
195
 
195
196
  def learning_tasks(content_modules)
196
197
  active_membership.task_statuses
197
- .for_content_module_ids(content_modules.map(&:id))
198
+ .for_content_module_ids(content_modules.map(&:id))
198
199
  end
199
200
 
200
201
  def stepping_suggestion
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Represents a single Participant authentication event.
2
3
  class ParticipantLoginEvent < ActiveRecord::Base
3
4
  belongs_to :participant
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ParticipantMetrics
2
3
  # Calculate weekly (by enrollment week) of records.
3
4
  class WeeklyCount < ActiveRecord::Base
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module ParticipantMetrics
2
3
  # Tabulate count of Logins within a study week for a Participant.
3
4
  class WeeklyLoginsCount < WeeklyCount
@@ -1,9 +1,10 @@
1
+ # frozen_string_literal: true
1
2
  require "securerandom"
2
3
 
3
4
  # Associates a Participant with an action on a date and provides an obfuscated
4
5
  # token representation.
5
6
  class ParticipantToken < ActiveRecord::Base
6
- TYPES = %w( phq9 wai )
7
+ TYPES = %w( phq9 wai ).freeze
7
8
  TOKEN_LENGTH = 10
8
9
 
9
10
  belongs_to :participant
@@ -21,7 +22,7 @@ class ParticipantToken < ActiveRecord::Base
21
22
  def others_on_this_day
22
23
  self.class.where(participant_id: participant_id,
23
24
  release_date: release_date)
24
- .where.not(id: id)
25
+ .where.not(id: id)
25
26
  end
26
27
 
27
28
  private
@@ -1,8 +1,11 @@
1
+ # frozen_string_literal: true
1
2
  # Collected responses from one Participant PHQ-9 assessment session.
2
3
  class PhqAssessment < ActiveRecord::Base
3
4
  MIN_QUESTION_SCORE = 0
4
5
  MAX_QUESTION_SCORE = 3
6
+ # rubocop:disable Style/MutableConstant
5
7
  QUESTION_ATTRIBUTES = :q1, :q2, :q3, :q4, :q5, :q6, :q7, :q8, :q9
8
+ # rubocop:enable Style/MutableConstant
6
9
  SUICIDAL_SCORE = 3
7
10
 
8
11
  belongs_to :participant
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Stepping suggestion based on Participant PHQ-9 results.
2
3
  #
3
4
  # An explanation of the algorithm:
@@ -58,8 +59,8 @@ class PhqStepping
58
59
 
59
60
  def results
60
61
  { step?: @step, stay?: @stay, release?: @release, upper_limit: @upper_limit,
61
- lower_limit: @lower_limit, current_week: @week, range_start: @range_start
62
- }
62
+ lower_limit: @lower_limit, current_week: @week,
63
+ range_start: @range_start }
63
64
  end
64
65
 
65
66
  private
@@ -232,8 +233,8 @@ class PhqStepping
232
233
  def previous_data_to_infer_from?
233
234
  unless @assessments.any? do |assessment|
234
235
  assessment
235
- .week_of_assessment
236
- .to_i < FIRST_PERIOD_STEPPING_WEEK
236
+ .week_of_assessment
237
+ .to_i < FIRST_PERIOD_STEPPING_WEEK
237
238
  end
238
239
  sort_assessments
239
240
  fill_in_missing_unknown_assessments