Tsugi

ClassroomQueue
in package

Classroom grades waiting on the teacher, and the log of attempts.

The queue is one row per result. A successful send deletes that row. Reset clears the error and leaves the row. It does not call Google. The log is append-only. Reset does not remove log rows.

Table of Contents

Constants

KIND_COURSEWORK  : mixed = 'coursework_create'
KIND_DUE  : mixed = 'due_date'
KIND_RECONNECT  : mixed = 'reconnect'
KIND_SCORE  : mixed = 'score'
STATE_ERROR  : mixed = 'error'
STATE_PENDING  : mixed = 'pending'

Methods

connection()  : mixed
Last refresh error for this teacher. Null clears it and stamps the check.
connectionStatus()  : array{connected: bool, status: string, checked_at: string}
coursesForOwner()  : array<int, array<string, mixed>>
Classroom courses this teacher installed.
drop()  : mixed
The result row is gone. Drop the queue row and do not write a status.
fail()  : mixed
Record a score that did not reach Classroom. The local grade stays.
installsInCourse()  : array<string, string>
Resource ids in this course that already have a Classroom link.
keepCurrent()  : mixed
A newer grade arrived while this send was in flight. Keep that grade queued and do not mark the older send as Sent.
logForContext()  : array{failures: array>, successes: array>}
Errors first, then successful attempts. Each list is the newest 20.
note()  : mixed
Coursework create, reconnect, or any non-score attempt.
queueForContext()  : array<int, array<string, mixed>>
reset()  : int
Clear errors on this course's queue. Does not call Google and does not delete the log.
rowsToSend()  : array<int, array<string, mixed>>
Rows still waiting, including ones whose last send failed.
scrub()  : mixed
succeed()  : mixed
The patch was accepted. Stamp the result Sent and the server time, then drop the queue row.
clip()  : mixed
deleteQueueRow()  : mixed
inheritId()  : mixed
inherit= on a Classroom launch path is the lesson resource id.
launchResourceId()  : mixed
Resource id at the end of a course discussion or lessons launch path.
logRows()  : array<int, array<string, mixed>>
markResult()  : mixed
upsert()  : mixed
writeLog()  : mixed

Constants

KIND_COURSEWORK

public mixed KIND_COURSEWORK = 'coursework_create'

Methods

connection()

Last refresh error for this teacher. Null clears it and stamps the check.

public static connection(int $userId, string|null $error) : mixed
Parameters
$userId : int
$error : string|null

connectionStatus()

public static connectionStatus(int $userId) : array{connected: bool, status: string, checked_at: string}
Parameters
$userId : int
Return values
array{connected: bool, status: string, checked_at: string}

coursesForOwner()

Classroom courses this teacher installed.

public static coursesForOwner(int $userId) : array<int, array<string, mixed>>
Parameters
$userId : int
Return values
array<int, array<string, mixed>>

drop()

The result row is gone. Drop the queue row and do not write a status.

public static drop(array<string, mixed> $row) : mixed
Parameters
$row : array<string, mixed>

fail()

Record a score that did not reach Classroom. The local grade stays.

public static fail(array<string, mixed> $row, string $message, int|null $http, string $url, string|null $request) : mixed
Parameters
$row : array<string, mixed>
$message : string
$http : int|null
$url : string
$request : string|null

installsInCourse()

Resource ids in this course that already have a Classroom link.

public static installsInCourse(int $contextId) : array<string, string>

The mirror link lives in the same course. Its key is the coursework id, and its path points at the lesson resource.

Parameters
$contextId : int
Return values
array<string, string>

keepCurrent()

A newer grade arrived while this send was in flight. Keep that grade queued and do not mark the older send as Sent.

public static keepCurrent(array<string, mixed> $row) : mixed
Parameters
$row : array<string, mixed>

logForContext()

Errors first, then successful attempts. Each list is the newest 20.

public static logForContext(int $contextId) : array{failures: array>, successes: array>}
Parameters
$contextId : int
Return values
array{failures: array>, successes: array>}

note()

Coursework create, reconnect, or any non-score attempt.

public static note(int $contextId, int $linkId, int $userId, string $kind, bool $success, string $detail[, int|null $http = null ][, string $url = '' ][, string|null $request = null ]) : mixed
Parameters
$contextId : int
$linkId : int
$userId : int
$kind : string
$success : bool
$detail : string
$http : int|null = null
$url : string = ''
$request : string|null = null

queueForContext()

public static queueForContext(int $contextId) : array<int, array<string, mixed>>
Parameters
$contextId : int
Return values
array<int, array<string, mixed>>

reset()

Clear errors on this course's queue. Does not call Google and does not delete the log.

public static reset(int $contextId) : int
Parameters
$contextId : int
Return values
int

rowsToSend()

Rows still waiting, including ones whose last send failed.

public static rowsToSend(int $contextId) : array<int, array<string, mixed>>
Parameters
$contextId : int
Return values
array<int, array<string, mixed>>

scrub()

public static scrub(mixed $text) : mixed
Parameters
$text : mixed

succeed()

The patch was accepted. Stamp the result Sent and the server time, then drop the queue row.

public static succeed(array<string, mixed> $row, int|null $http, string $url, string|null $request) : mixed
Parameters
$row : array<string, mixed>
$http : int|null
$url : string
$request : string|null

clip()

private static clip(string $text, int $limit) : mixed
Parameters
$text : string
$limit : int

deleteQueueRow()

private static deleteQueueRow(array<string, mixed> $row) : mixed
Parameters
$row : array<string, mixed>

inheritId()

inherit= on a Classroom launch path is the lesson resource id.

private static inheritId(mixed $path) : mixed
Parameters
$path : mixed

launchResourceId()

Resource id at the end of a course discussion or lessons launch path.

private static launchResourceId(mixed $path) : mixed
Parameters
$path : mixed

logRows()

private static logRows(int $contextId, int $success) : array<int, array<string, mixed>>
Parameters
$contextId : int
$success : int
Return values
array<int, array<string, mixed>>

markResult()

private static markResult(array<string, mixed> $row, float|null $grade, string|null $error) : mixed
Parameters
$row : array<string, mixed>
$grade : float|null
$error : string|null

upsert()

private static upsert(array<string, mixed> $row, string $state, string $detail) : mixed
Parameters
$row : array<string, mixed>
$state : string
$detail : string

writeLog()

private static writeLog(array<string, mixed> $row, string $kind, bool $success, int|null $http, string $url, string|null $request, string $detail) : mixed
Parameters
$row : array<string, mixed>
$kind : string
$success : bool
$http : int|null
$url : string
$request : string|null
$detail : string

        
On this page

Search results