Class: TaskStatus

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/task_status.rb

Overview

Holds the completion status of a task for each participant

Instance Method Summary collapse

Instance Method Details

#available_for_learning_onObject



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

Returns:

  • (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_completeObject



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

Returns:

  • (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

Returns:

  • (Boolean)


70
71
72
# File 'app/models/task_status.rb', line 70

def provider_viz?
  try(:bit_core_content_module).try(:is_viz)
end