think_feel_do_engine 3.16.3 → 3.17.0

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: 89d1464ca97c531f291297d3c164f3b0a2a0ffc2
4
- data.tar.gz: 9170ef2da22aa467905f9fb68cb6467e3100e153
3
+ metadata.gz: a1aeba41ab19d644e3b61f35f1a0b5a12599b44b
4
+ data.tar.gz: f5ab432d31659ccc124231abcd98314d4840238e
5
5
  SHA512:
6
- metadata.gz: 0cf15943099b8b433d21795cc55f9a2afbdcc674896f8e6967fc25250efd8d7ed9f7bf2832d624e8f1525a5cad1ca9aa8a849fe5e8a079d0f867472fc942438e
7
- data.tar.gz: 8ce320ff11c63852a30ed6350ef61db7cc6c0f098024f120a6c694f0e18906cd8709e86e66f55a083d2a5bf9ef8fde56cde9aed27cef41c7a1f3dd80cbc34d7f
6
+ metadata.gz: d8999ed4d317cb5c7537d140ea008179e170e52b345d56fa3ce3db6431bf5c0f3dd92c9a0865373ede0acbcf5ac678ceb1e6a5be058a04786b5420c3cc8c1558
7
+ data.tar.gz: c7f36ad1f51765a3c90befd9b873d4a0840fff5a62c56708ddf655cfb24576aebc246a857f7bcf9c3953ec520d1312fa526886dae2b5e986deb3edb8d52e15ef
@@ -8,5 +8,4 @@
8
8
  //= require_tree ./forms
9
9
  //= require_tree ./thought_patterns
10
10
  //= require_tree ./thoughts
11
- //= require think_feel_do_engine/task_status
12
11
  //= require think_feel_do_engine/responsive-table
@@ -25,6 +25,9 @@ module ThinkFeelDoEngine
25
25
  provider_id: params[:provider_id],
26
26
  content_position: params[:content_position]
27
27
  )
28
+
29
+ complete_task_status(params[:module_id])
30
+
28
31
  render "show_content"
29
32
  rescue ActiveRecord::RecordNotFound, ActionView::Template::Error
30
33
  @navigator.initialize_context(home_tool.title)
@@ -33,7 +36,6 @@ module ThinkFeelDoEngine
33
36
  end
34
37
 
35
38
  def show_next_content
36
- mark_engagement_completed
37
39
  @navigator.fetch_next_content
38
40
 
39
41
  if @navigator.current_module
@@ -75,20 +77,17 @@ module ThinkFeelDoEngine
75
77
 
76
78
  private
77
79
 
78
- def last_engagment
79
- current_participant
80
- .active_membership
81
- .task_statuses
82
- .for_content_module(navigator_content_module)
83
- .try(:last)
84
- .try(:engagements)
85
- .try(:last)
86
- end
87
-
88
- def mark_engagement_completed
89
- if navigator_content_module && last_engagment
90
- last_engagment.update_attributes(completed_at: DateTime.current)
91
- end
80
+ def complete_task_status(module_id)
81
+ content_module = BitCore::ContentModule.find(module_id)
82
+ membership = current_participant
83
+ .active_membership
84
+ @task_status = membership
85
+ .task_statuses
86
+ .for_content_module(content_module)
87
+ .available_by_day(membership.day_in_study)
88
+ .try(:order, "start_day DESC")
89
+ .try(:first)
90
+ @task_status.mark_complete unless @task_status.nil?
92
91
  end
93
92
 
94
93
  def module_exist?
@@ -6,7 +6,6 @@ class TaskStatus < ActiveRecord::Base
6
6
  belongs_to :membership
7
7
  belongs_to :task
8
8
  has_one :participant, through: :membership
9
- has_many :engagements, dependent: :destroy
10
9
 
11
10
  delegate :bit_core_content_module,
12
11
  :bit_core_content_module_id,
@@ -94,8 +94,8 @@
94
94
  <% end %>
95
95
 
96
96
  <div class="btn-group pull-right">
97
- <%= submit_tag t(:next), class: "btn btn-primary", id: "submit_activities" %>
98
97
  <%= link_to t(:skip), navigator_next_content_path, class: "btn btn-warning" %>
98
+ <%= submit_tag t(:next), class: "btn btn-primary", id: "submit_activities" %>
99
99
  </div>
100
100
  <% end # form_for %>
101
101
 
@@ -42,7 +42,7 @@
42
42
  <%= render partial: "think_feel_do_engine/coach/group_dashboard/comments", locals: {group: @group} %>
43
43
 
44
44
  <a name="goals_table"></a>
45
- <%= render partial: "think_feel_do_engine/coach/group_dashboard/goals", locals: {group: @group} %>
45
+ <%= render partial: "think_feel_do_engine/coach/group_dashboard/goals", locals: { group: @group} %>
46
46
 
47
47
  <a name="likes_table"></a>
48
48
  <%= render partial: "think_feel_do_engine/coach/group_dashboard/likes", locals: {group: @group} %>
@@ -15,8 +15,8 @@
15
15
  </div>
16
16
 
17
17
  <div class="btn-toolbar">
18
- <%= submit_tag t(:next), class: 'btn btn-primary', id: "submit-forms" %>
19
18
  <%= link_to t(:skip), navigator_next_content_path, class: "btn btn-warning" %>
19
+ <%= submit_tag t(:next), class: 'btn btn-primary', id: "submit-forms" %>
20
20
  </div>
21
21
 
22
22
  <script>
@@ -57,6 +57,6 @@
57
57
  </div>
58
58
  </div>
59
59
 
60
- <%= f.submit t(:next), class: "btn btn-primary" %>
61
60
  <%= link_to t(:skip), navigator_next_content_path, class: "btn btn-warning" %>
61
+ <%= f.submit t(:next), class: "btn btn-primary" %>
62
62
  <% end %>
@@ -23,6 +23,6 @@
23
23
  </div>
24
24
  </div>
25
25
 
26
- <%= f.submit t(:next), class: "btn btn-primary" %>
27
26
  <%= link_to t(:skip), navigator_next_content_path, class: "btn btn-warning" %>
27
+ <%= f.submit t(:next), class: "btn btn-primary" %>
28
28
  <% end %>
@@ -33,7 +33,7 @@
33
33
  <% release_date = ts.available_for_learning_on %>
34
34
  <% if ts.accessible? %>
35
35
  <span class="list-group-item task-status enabled">
36
- <%= link_to create_task_path(ts), class: "task-status", id: "task-status-#{ ts.id }", data: { :"task-status-id" => ts.id } do %>
36
+ <%= link_to create_task_path(ts), class: "task-status", id: "task-status-#{ ts.id }" do %>
37
37
  <h4 class="list-group-item-heading">
38
38
  <span class="lesson <%= ts.completed_at ? "read" : "unread" %>"><%= ts.task.bit_core_content_module.pretty_title %></span>
39
39
  </h4>
@@ -53,7 +53,7 @@
53
53
  </p>
54
54
  </span>
55
55
  <% else %>
56
- <span class="list-group-item task-status disabled" id="task-status-<%= ts.id %>" data-task-status-id="<%= ts.id %>">
56
+ <span class="list-group-item task-status disabled" id="task-status-<%= ts.id %>">
57
57
  <h4 class="list-group-item-heading">
58
58
  <span class="lesson unread"><%= ts.task.bit_core_content_module.pretty_title %></span>
59
59
  </h4>
@@ -28,8 +28,7 @@
28
28
  <li>
29
29
  <%= link_to think_feel_do_engine.navigator_location_path(module_id: module_nav_item.id),
30
30
  class: "task-status",
31
- id: "task-status-#{ module_nav_item.task_status_id }",
32
- data: { :"task-status-id" => module_nav_item.task_status_id } do %>
31
+ id: "task-status-#{ module_nav_item.task_status_id }" do %>
33
32
  <%= module_nav_item.has_didactic_content? ? fa_icon("book") : fa_icon("pencil") %> <%= module_nav_item.title %>
34
33
  <% end %>
35
34
  </li>
@@ -1,4 +1,9 @@
1
1
  class AddMissingFkConstraints < ActiveRecord::Migration
2
+ class MigrationEngagement < ActiveRecord::Base
3
+ self.table_name = :engagements
4
+ belongs_to :task_status
5
+ end
6
+
2
7
  def change
3
8
  EmotionalRating.where(emotion_id: nil).destroy_all
4
9
  EmotionalRating.all.each do |r|
@@ -10,7 +15,7 @@ class AddMissingFkConstraints < ActiveRecord::Migration
10
15
  ContentProviderPolicy.all.each do |p|
11
16
  p.destroy if p.content_provider.nil?
12
17
  end
13
- Engagement.all.each do |e|
18
+ MigrationEngagement.all.each do |e|
14
19
  e.destroy if e.task_status.nil?
15
20
  end
16
21
  Task.all.each do |t|
@@ -1,4 +1,4 @@
1
1
  # nodoc
2
2
  module ThinkFeelDoEngine
3
- VERSION = "3.16.3"
3
+ VERSION = "3.17.0"
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.16.3
4
+ version: 3.17.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-05-03 00:00:00.000000000 Z
11
+ date: 2016-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -371,7 +371,6 @@ files:
371
371
  - app/assets/javascripts/think_feel_do_engine/shared/detect_timeout.js
372
372
  - app/assets/javascripts/think_feel_do_engine/slideshows.js
373
373
  - app/assets/javascripts/think_feel_do_engine/stepped_care.js
374
- - app/assets/javascripts/think_feel_do_engine/task_status.js
375
374
  - app/assets/javascripts/think_feel_do_engine/thought_patterns/index.js.erb
376
375
  - app/assets/javascripts/think_feel_do_engine/thoughts/edit_bulk.js
377
376
  - app/assets/javascripts/think_feel_do_engine/thoughts/scThoughtTrackerMenuViz.js
@@ -419,7 +418,6 @@ files:
419
418
  - app/controllers/think_feel_do_engine/participants/passwords_controller.rb
420
419
  - app/controllers/think_feel_do_engine/participants/public_slides_controller.rb
421
420
  - app/controllers/think_feel_do_engine/participants/sessions_controller.rb
422
- - app/controllers/think_feel_do_engine/participants/task_status_controller.rb
423
421
  - app/controllers/think_feel_do_engine/participants/thoughts_controller.rb
424
422
  - app/controllers/think_feel_do_engine/password_entropy_bits_controller.rb
425
423
  - app/controllers/think_feel_do_engine/privacy_policies_controller.rb
@@ -505,7 +503,6 @@ files:
505
503
  - app/models/delivered_message.rb
506
504
  - app/models/emotion.rb
507
505
  - app/models/emotional_rating.rb
508
- - app/models/engagement.rb
509
506
  - app/models/experience.rb
510
507
  - app/models/gratitude_recording.rb
511
508
  - app/models/group.rb
@@ -1,19 +0,0 @@
1
- ;(function() {
2
- "use strict";
3
-
4
- // Report actions associated with task statuses
5
- $(document).on("page:change", function() {
6
- $("a.task-status").not(".disabled").on("click", function(event) {
7
- var $target, $taskStatusId;
8
-
9
- $target = $(event.currentTarget);
10
- $taskStatusId = $target.data("task-status-id");
11
- $.ajax({
12
- async: false,
13
- dataType: "script",
14
- type: "PUT",
15
- url: "/participants/task_status/" + $taskStatusId
16
- });
17
- });
18
- });
19
- })();
@@ -1,35 +0,0 @@
1
- require_dependency "think_feel_do_engine/application_controller"
2
-
3
- module ThinkFeelDoEngine
4
- module Participants
5
- # Updates the completion of assigned tasks for a participant
6
- class TaskStatusController < ApplicationController
7
- before_action :authenticate_participant!
8
-
9
- rescue_from ActiveRecord::RecordNotFound, with: :record_not_found
10
-
11
- def update
12
- @task_status = current_participant
13
- .active_membership
14
- .task_statuses
15
- .find(params[:id])
16
-
17
- begin
18
- if @task_status.engagements.build && @task_status.mark_complete
19
- render nothing: true, status: 200
20
- else
21
- render nothing: true, status: 400
22
- end
23
- rescue ActiveRecord::InvalidForeignKey
24
- render nothing: true, status: 400
25
- end
26
- end
27
-
28
- private
29
-
30
- def record_not_found
31
- render nothing: true, status: 404
32
- end
33
- end
34
- end
35
- end
@@ -1,7 +0,0 @@
1
- # Used to determine when a patient starts and completes learn task_statuses
2
- class Engagement < ActiveRecord::Base
3
- belongs_to :task_status
4
-
5
- delegate :participant_id, to: :task_status, prefix: false
6
- delegate :participant, to: :task_status, prefix: false
7
- end