class ScormEngine::Models::RegistrationActivityDetail
Attributes
@attr Represents whether the current attempt on the activity has been completed. @return [String] (UNKNOWN COMPLETED INCOMPLETE)
@attr Pass/fail status of primary objective for this activity. @return [String] (UNKNOWN PASSED FAILED)
@attr A nested array of activity details @return [Array<ScormEngine::Models::RegistrationActivityDetail>]
@attr The external identification of the registration. @return [String]
@attr Represents whether the previous attempt on the activity has been completed. @return [String] (Unknown Completed Incomplete)
@attr
@return [Array<ScormEngine::Models::RegistrationRuntimeInteraction>]
Public Class Methods
# File lib/scorm_engine/models/registration_activity_detail.rb, line 59 def self.get_runtime_interactions_from_api(options) options .fetch("runtime", {}) .fetch("runtimeInteractions", []) .map { |e| RegistrationRuntimeInteraction.new_from_api(e) } end
# File lib/scorm_engine/models/registration_activity_detail.rb, line 34 def self.new_from_api(options = {}) this = new this.options = options.dup this.id = options["id"] this.activity_completion = options["activityCompletion"]&.upcase this.previous_attempt_completion = options["previousAttemptCompletion"]&.upcase this.activity_success = options["activitySuccess"]&.upcase this.runtime_interactions = get_runtime_interactions_from_api(options) this.children = options.fetch("children", []).map { |e| new_from_api(e) } this end
Public Instance Methods
Return a flattened array of all runtime interactions
@return [Array<RegistrationRuntimeInteraction>]
# File lib/scorm_engine/models/registration_activity_detail.rb, line 55 def all_runtime_interactions (runtime_interactions + children.map(&:all_runtime_interactions)).flatten end
Has this activity been completed?
@return [Boolean]
Returns true, false or nil if completion status is unknown.
# File lib/scorm_engine/models/registration_activity_detail.rb, line 72 def complete? return nil if activity_completion == "UNKNOWN" activity_completion == "COMPLETED" end
Has this activity failed?
@return [Boolean]
Returns true, false or nil if success status is unknown.
# File lib/scorm_engine/models/registration_activity_detail.rb, line 127 def failed? return nil if activity_success == "UNKNOWN" activity_success == "FAILED" end
Is this activity incomplete?
@return [Boolean]
Returns true, false or nil if completion status is unknown.
# File lib/scorm_engine/models/registration_activity_detail.rb, line 83 def incomplete? return nil if activity_completion == "UNKNOWN" activity_completion == "INCOMPLETE" end
Has this activity been passed?
@return [Boolean]
Returns true, false or nil if success status is unknown.
# File lib/scorm_engine/models/registration_activity_detail.rb, line 116 def passed? return nil if activity_success == "UNKNOWN" activity_success == "PASSED" end
Has the previous attempt of this activity been completed?
@return [Boolean]
Returns true, false or nil if completion status is unknown.
# File lib/scorm_engine/models/registration_activity_detail.rb, line 94 def previous_attempt_complete? return nil if previous_attempt_completion == "UNKNOWN" previous_attempt_completion == "COMPLETED" end
Is the previous attempt of this previous_attempt incomplete?
@return [Boolean]
Returns true, false or nil if completion status is unknown.
# File lib/scorm_engine/models/registration_activity_detail.rb, line 105 def previous_attempt_incomplete? return nil if previous_attempt_completion == "UNKNOWN" previous_attempt_completion == "INCOMPLETE" end