Ltix.GradeService.Result (Ltix v0.1.0)

Copy Markdown View Source

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.

Types

t()

@type t() :: %Ltix.GradeService.Result{
  comment: String.t() | nil,
  extensions: %{optional(String.t()) => term()},
  id: String.t() | nil,
  result_maximum: number() | nil,
  result_score: number() | nil,
  score_of: String.t() | nil,
  scoring_user_id: String.t() | nil,
  user_id: String.t() | nil
}

Functions

from_json(json)

@spec from_json(map()) :: {:ok, t()}

Parse a result from a decoded JSON map.

Accepts any map and extracts known fields. Unrecognized keys are captured 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}