A result record from the platform's gradebook.
Results are read-only. The platform provides them via the result service. Each result represents the current grade for a specific line item and user.
When result_maximum is nil, consumers should treat it as 1
per the spec default.
Examples
{:ok, result} = Ltix.GradeService.Result.from_json(%{
"userId" => "5323497",
"resultScore" => 0.83,
"resultMaximum" => 1
})
result.result_score
#=> 0.83
Summary
Functions
Parse a result from a decoded JSON map.
Serialize a result to a map with camelCase string keys.
Types
Functions
@spec from_json(map()) :: {:ok, t()} | {:error, Exception.t()}
Parse a result from a decoded JSON map.
Accepts any map and extracts known fields. Fields with the wrong type are
nil. Unrecognized keys are kept in extensions.
Examples
iex> {:ok, result} = Ltix.GradeService.Result.from_json(%{"userId" => "123", "resultScore" => 0.5})
iex> {result.user_id, result.result_score}
{"123", 0.5}
Serialize a result to a map with camelCase string keys.
Examples
iex> result = %Ltix.GradeService.Result{user_id: "123", result_score: 0.5}
iex> Ltix.GradeService.Result.to_map(result)
%{"userId" => "123", "resultScore" => 0.5}