Class: TaskStatus
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- TaskStatus
- Defined in:
- app/models/task_status.rb
Overview
Holds the completion status of a task for each participant
Instance Method Summary collapse
- #available_for_learning_on ⇒ Object
- #is_lesson? ⇒ Boolean
- #mark_complete ⇒ Object
- #notify_today? ⇒ Boolean
- #provider_viz? ⇒ Boolean
Instance Method Details
#available_for_learning_on ⇒ Object
91 92 93 |
# File 'app/models/task_status.rb', line 91 def available_for_learning_on membership.start_date + release_day - 1 end |
#is_lesson? ⇒ Boolean
82 83 84 |
# File 'app/models/task_status.rb', line 82 def is_lesson? task.bit_core_content_module.type == "ContentModules::LessonModule" end |
#mark_complete ⇒ Object
74 75 76 77 78 79 80 |
# File 'app/models/task_status.rb', line 74 def mark_complete if completed_at save! else update_attributes(completed_at: DateTime.current) end end |
#notify_today? ⇒ Boolean
86 87 88 89 |
# File 'app/models/task_status.rb', line 86 def notify_today? today = Time.now start_day == ((today.to_date - membership.start_date.to_date).to_i + 1) end |
#provider_viz? ⇒ Boolean
70 71 72 |
# File 'app/models/task_status.rb', line 70 def provider_viz? try(:bit_core_content_module).try(:is_viz) end |