Skip to content

Yearly goals

tilttek/reading-quests-bundle

Tilttek\ReadingQuestsBundle\Application\ReaderGoals keeps each reader's goal for a calendar year and reads where they stand.

$goals->setBooks('member:44', 2026, 12);        // finish 12 books in 2026
$goals->setAmount('member:44', 2027, 3000);     // read 3 000 pages, or minutes, in 2027

$progress = $goals->progress('member:44', 2026);
$progress?->done;        // books finished so far
$progress?->remaining(); // what is left
$progress?->percent();   // 0 to 100
$progress?->ahead();     // ahead of an even pace through the year; negative when behind

One goal a year

A reader has at most one goal a year. Setting it again replaces it: the progress is read again from the journal, so a target raised or lowered during the year loses nothing. remove() takes it away; goal() gives it, null when there is none, and progress() is null then too.

What is counted

A goal of books counts the book.finished activities of the year; a goal of an amount sums the book.read activities, in the unit the site measures in — the unit is kept with the goal, so a site that changes its measure keeps reading the old goals in their own unit. The year runs from 1 January to 1 January in the timezone of the configuration.

The pace is the reader's alone: nothing compares readers, and no ranking is built.