Result

A Result provides additional information about the outcome or status of an activity. When sending an activity statement, you can configure which information to include in the result. This allows you to communicate details such as whether the activity was completed, if it was successful, how long it took, the score achieved, and any relevant response string. All fields are optional, so you can include only the information that is relevant to your use case.

📝 Examples

Basic Completion Result

This example demonstrates the minimum information needed to record that a user has completed a module.

using PorticoXR.Reporting.Statements;

// Create a result indicating completion and success
var result = new Result
{
    Completion = true,
    Success = true
};

Result with All Fields

This example illustrates how to include all available fields in a result, capturing comprehensive details about the activity outcome.

using PorticoXR.Reporting.Statements;

// Create a result with all possible fields populated
var result = new Result
{
    Completion = true,
    Success = true,
    Duration = 30, // Duration in seconds
    Response = "Response text",
    Score = new Score
    {
        Scaled = 0.5f, // 50% of the maximum score
        Min = 0f,
        Max = 100,
        Raw = 50f
    }
};

🛠️ Best Practices

When constructing a result, keep the following in mind:

  • Only include fields that are relevant to your scenario.
  • Ensure that score values are consistent and meaningful (e.g., Raw should typically be between Min and Max, and Scaled should be between 0.0 and 1.0).
  • Avoid sending unnecessary or duplicated information.

⚠️ No validation is performed on score values. It is your responsibility to ensure that the values you send are correct and logically consistent for your app.