Skip to content

Quiz and assignment due dates - #3446

Draft
brianhogg wants to merge 31 commits into
devfrom
poc/due-dates
Draft

brianhogg wants to merge 31 commits into
devfrom
poc/due-dates

Conversation

@brianhogg

@brianhogg brianhogg commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds quiz and assignment due dates.

Adds due dates to quizzes, plus the shared code the Assignments add-on uses for assignment due dates (companion PR: gocodebox/lifterlms-assignments#180).

  • LLMS_Trait_Due_Date (used by LLMS_Quiz, and by LLMS_Assignment in the add-on):
    • Due options follow the drip model: none, a specific date, # of days after enrollment, or # of days after course start.
    • An optional time of day; when empty, the item is due at 11:59 PM.
    • Statuses: upcoming, due soon, overdue, on time, late.
    • "Late" is calculated against the student's current due date and never stored, so a later extension clears it.
    • Times are Unix (UTC) timestamps compared to time() and shown with wp_date(); llms_current_time() isn't used. Due dates set on a quiz are entered in the site's timezone, per-student due dates are stored in UTC, and day-based dates and extensions add calendar days in the site's timezone so 11:59 PM stays 11:59 PM across daylight saving time.
  • Builder: a Due Date block in quiz settings (Schemas/DueDate.js, reused by Assignments).
  • Students:
    • The lesson shows one short list of its quiz and assignment due dates above the Start Assignment / Take Quiz buttons (templates/course/lesson-due-dates.php). The focus mode footer shows only the buttons.
    • The syllabus shows a compact date that wraps (Oct 25, 25 Oct, 25 de Oct; the year only appears when it isn't the current year). Sites can change it with the llms_short_date_format filter.
    • Quiz Information shows the full date with the time zone, and a past-due note when late submissions are still possible.
    • Without LifterLMS styles, the status reads as "Due: Oct 25 · Overdue"; the separator is hidden when the badge styles load.
  • Reporting:
    • A LATE badge on quiz attempts and a "Late by X" widget on a single attempt.
    • A Due Dates table on the student's course report, to change one student's due date (or remove it) with an instructor-only reason.
  • Accessibility accommodation (separate commit): a LifterLMS Profile option next to "Allow unlimited quiz time":
    • Extend every due date by X days, or remove due dates for the student.
    • A due date changed for the student on a single item takes precedence.

Review fixes (one commit each):

  1. 4886de0 Lesson due dates as one list above the buttons; focus mode footer shows only the buttons.
  2. 5a3d273 Readable markup without LifterLMS styles (separator and <time datetime>).
  3. 21de98b Compact, wrapping syllabus date using the site's date format and locale.
  4. 3169d85 Student-facing polish: no indent or opacity on due lines, darker "due soon" badge for contrast, time zone on full dates, past-due note.
  5. af831cf The admin Due Dates table stacks into cards below 782px.
  6. 7ac1cb2 Accessibility of the admin controls: profile accommodation <fieldset> and <legend>, labelled inputs, aria-describedby; an "Actions" column header and per-item "Change due date for …" button names.

Accessibility and translation fixes (one commit each):

  1. 3160d15 <time datetime> includes a UTC offset (superseded by 1ae1c57).

  2. 47f24e2 Screen readers hear "Status: Overdue" after the date, and syllabus items are separated ("Has Quiz, Due: Nov 5, Status: Overdue.").

  3. e2a3709 Translator comments on short or ambiguous strings (statuses, "Late", "Adjusted", "Item", "Time", "days").

  4. b5ad17e The per-student "Change" control is a real <button> with aria-expanded/aria-controls. Opening moves focus to the date, Escape closes and returns focus, "No due date" disables the date and time fields. After saving (or a validation error) the page returns to the notice and focuses it; the notice names the item.

  5. 757e929 Course builder settings fields are labelled for screen readers (aria-labelledby, help tips as aria-describedby, Select2 reads "Due, On a specific date"). This applies to every builder field, not only due dates.

  6. 1ae1c57 UTC timestamps throughout, as described above. Quiz attempt dates, which core stores in the site's timezone, are converted with get_gmt_from_date(); <time datetime> is printed in UTC (2026-10-26T03:59:00+00:00).

Late penalty (Step 1), manual only:

  1. aa765cb Quiz attempts get late_penalty and late_penalty_note columns. calculate_grade() takes the penalty off the score (capped at the score) and decides pass/fail from the final grade, which stays in the grade column. Adds get_score(), get_late_penalty() and the llms_quiz_attempt_late_penalty filter.
  2. 7961cfc A Late penalty box on the single quiz attempt screen for late attempts, for users who can edit the quiz. Saving regrades through the same steps as Save Review (now shared in regrade()), so a pass that becomes a fail sends the quiz failed notification and the reverse sends quiz passed. Completion and awards are not revoked, as with any regrade.
  3. f3d1d62 Students see the score, penalty and note on their attempt results; the attempts tables show a "−X% late" badge; the student attempts export gets Score, Late Penalty and Late Penalty Note columns.
  4. c12df33 Controller test and changelog entry.
  5. 570a184 Read-only score, late_penalty and late_penalty_note on the quiz attempts REST API.
  6. b95918d Score, late penalty and note rows in the Quiz Data personal data export.
  7. e60b820 A penalty on an attempt awaiting review is stored without regrading, so no "quiz graded" notification goes out before there's a grade; finishing the review applies it.
  8. 004d6b9 Penalty box spacing and small-screen layout.

Advanced Quizzes needs no changes: it grades individual questions through core filters, and the attempt grade always comes from calculate_grade().

Not included: an automatic late policy, bulk penalties, REST write support for penalties, CLI fields, and moving the rest of core off site-local dates.

How has this been tested?

Tested manually in wp-env with a demo course: 4 lessons, 4 quizzes, 3 assignments (Assignments add-on on its due dates branch, gocodebox/lifterlms-assignments#180), and two students.

  • The builder saves the due date settings, and the Due fields show and hide as the option changes.
  • All six statuses calculate as expected.
  • A per-student due date change, "No due date", and reset all work from reporting. An extension granted after a late attempt removes its LATE badge.
  • Profile accommodation:
    • +7 days moves every due date by 7 days for that student only.
    • "No due dates" hides all due dates for that student.
    • A per-item change still wins over the accommodation.
  • The builder still works with Advanced Quizzes active; its Question Bank field and the Due Date fields both render.
  • PHPUnit --filter 'Quiz|Generator|Student|Profile': 397 tests pass. The generator fixture gained the new quiz keys.
  • After the review fixes, PHPUnit --filter 'Quiz|Lesson|Student|Profile|Due': 392 tests pass (23 skipped, all existing skips). test_get_short_date_format covers the compact date format.
  • Front end captured as an enrolled student at 412px, 768px, 1024px and 1440px wide in Twenty Twenty-Five, Sky Pilot, Astra and Kadence, with and without focus mode.
  • Syllabus checked with the site language set to English, French and Spanish: dates are localized and wrap without overflowing.
  • After the accessibility fixes, PHPUnit --filter 'Quiz|Lesson|Student|Profile|Due|Assets': 449 tests pass (23 skipped, 1 incomplete, all existing). test_get_due_timestamp_utc (fixed dates in EDT and EST, a 7 day extension across the end of DST, a UTC per-student date, and late detection on a site-timezone submission) fails without 1ae1c57 and passes with it.
  • UTC change checked end to end on a test site set to America/Toronto: every due date, status, LATE badge and admin date/time input on 15 student and admin pages reads the same before and after; only the datetime attributes changed, to the same moments in UTC. Saving 11:59 PM Oct 25 from the admin form stores 2026-10-26 03:59:00.
  • Accessibility checked with Playwright accessibility snapshots and keyboard-only runs (Tab, Enter, Escape, Save, invalid date) in wp-admin; the course builder showed no console errors. The visually hidden text stays 1×1px in Twenty Twenty-Five, Sky Pilot and Astra, and the student pages are pixel-identical before and after in Twenty Twenty-Five.
  • Late penalty: applied 35% to a 100% late attempt on the test site; it became 65% / Fail and created quiz_failed and quiz_graded notifications. Removing it restored 100% / Pass with quiz_passed and quiz_graded. test_late_penalty_regrades_attempt covers the same through the controller, plus no actions on an unchanged save and no access for students. PHPUnit --filter 'Quiz|Lesson|Due' (233 tests) and --filter 'Table|Install|Controller' (481 tests) pass.
  • Late penalty follow-ups: test_get_item_late_penalty and test_late_penalty_pending_attempt added; PHPUnit --filter 'Quiz|Lesson|Due|Controller|Privacy' (553 tests) passes. With Advanced Quizzes active, a late attempt with fill-in-the-blank, reorder and long answer questions took the penalty on review (75% → 55%, Fail, quiz failed notification) and through the REST grade endpoint.
  • phpcs: no errors on the changed PHP files.

Screenshots

See the comments below.

Types of changes

New feature (non-breaking change which adds functionality)

Checklist:

  • This PR requires and contains at least one changelog file.
  • My code has been tested.
  • My code passes all existing automated tests.
  • My code follows the LifterLMS Coding & Documentation Standards.

ampagent and others added 2 commits November 4, 2026 14:36
Adds a shared due date trait, quiz due date settings in the builder,
student-facing due dates and status badges, late flags in quiz reporting,
and per-student due date changes on the student course reporting screen.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1a296-f04e-701b-bfda-1b9198c59450
Co-authored-by: brianhogg <brian@brianhogg.com>
Adds a LifterLMS Profile option next to "Allow unlimited quiz time" to
extend every quiz and assignment due date by a number of days, or remove
due dates entirely, for accessibility accommodations. Per-item due dates
for the student still take precedence, and the reporting Due Dates table
shows when an accommodation applies.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1a296-f04e-701b-bfda-1b9198c59450
Co-authored-by: brianhogg <brian@brianhogg.com>
@brianhogg brianhogg moved this to Awaiting Review in Development Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Screenshots (local wp-env)

Builder: quiz due on a specific date and time

Builder: quiz due a number of days after enrollment

Syllabus with due dates and statuses

Lesson buttons

Quiz Information

Reporting: Due Dates table on the student's course report

Changing one student's due date

After extensions: the late quiz is now on time

Quiz attempts with a LATE badge

Single attempt: Late by 2 days

Accessibility accommodation (profile)

Profile option

+7 days: reporting and the student's syllabus

No due dates: reporting and the student's syllabus

ampagent and others added 6 commits November 9, 2026 18:43
Due dates were loose text between the Take Quiz / Start Assignment
buttons inside .llms-lesson-button-wrapper, which themes lay out as a
button row (Sky Pilot crushed the buttons; other themes split a date
from its button). They now render as one list before the buttons via
the new course/lesson-due-dates.php template, so the button row and
the focus mode footer keep only the buttons.

Adds LLMS_Lesson::get_due_date_items() so reporting and the lesson
list share the llms_lesson_due_date_items filter.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1a296-f04e-701b-bfda-1b9198c59450
Co-authored-by: brianhogg <brian@brianhogg.com>
Adds a separator before the status ("Due: Oct 25, 2026 · On time")
that LifterLMS styles hide, for themes that replace the LifterLMS
stylesheet. The <time> element now has a machine-readable datetime.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1a296-f04e-701b-bfda-1b9198c59450
Co-authored-by: brianhogg <brian@brianhogg.com>
Syllabus due dates use a short version of the site's date format
(month abbreviated, year dropped for the current year), keeping the
site's date order and localized month names, e.g. "Nov 20",
"20 Nov", "20 de Nov". Dates can wrap now, so they no longer push
lesson rows wider than small screens.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1a296-f04e-701b-bfda-1b9198c59450
Co-authored-by: brianhogg <brian@brianhogg.com>
- Remove the stray indent and reduced opacity on standalone due dates.
- Darken the "due soon" badge to meet WCAG AA contrast.
- Add the site time zone abbreviation to full due dates.
- Tell students they can still submit overdue work, and that it will
  be marked late.

Co-authored-by: brianhogg <brian@brianhogg.com>
Below the 782px WordPress admin breakpoint, each item becomes a card
with the column name before each value, and the Change form uses the
full card width instead of pushing past the table edge.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1a296-f04e-701b-bfda-1b9198c59450
Co-authored-by: brianhogg <brian@brianhogg.com>
- Profile accommodation: use a fieldset legend, give each radio and
  the days input its own label, and link the description with
  aria-describedby. Move inline styles to the admin stylesheet.
- Due Dates report: label the actions column and name each Change
  button after its item for screen readers.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1a296-f04e-701b-bfda-1b9198c59450
Co-authored-by: brianhogg <brian@brianhogg.com>

brianhogg commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor Author

Review fixes: before and after

Commits 4886de0…7ac1cb2. Sky Pilot styles are in the draft gocodebox/sky-pilot#233.

1. Lesson due dates as one list above the buttons (4886de0)

Mobile, in Twenty Twenty-Five, Sky Pilot, Astra and Kadence:

Lesson due date list on mobile, before and after

Laptop (1024px):

Lesson due date list on laptop, before and after

Focus mode: the footer now shows only the buttons. The due dates stay in the lesson body.

Focus mode footer, before and after

2. Markup without LifterLMS styles (5a3d273), with matching Sky Pilot styles (gocodebox/sky-pilot#233)

Sky Pilot syllabus, before and after

3. Compact, wrapping syllabus dates in English, French and Spanish (21de98b)

Syllabus dates by locale

The new strings ("Has Quiz", "Due:") show in English on the French and Spanish sites because they have no translations yet.

4. Student-facing polish (3169d85): time zone on full dates, past-due note, no indent or opacity on the assignment's due line, and a darker "due soon" badge for contrast.

Quiz and assignment polish, before and after

5. Admin Due Dates table on small screens (af831cf)

Admin Due Dates table on mobile, before and after

After, at desktop, tablet and mobile widths (the second panel has the Change form open):

Admin Due Dates table at three widths

6. Accessibility of the profile accommodation fields (7ac1cb2)

Before (top) and after (bottom):

Profile accommodation fields, before and after

The My Grades widget overflow found during the same review is not caused by this PR; it is tracked in #3462 / #3463.

@brianhogg brianhogg changed the title POC: Quiz and assignment due dates Quiz and assignment due dates Nov 9, 2026
ampagent and others added 5 commits November 9, 2026 20:32
The <time datetime> value had no offset, so it read as a floating
local time. Due timestamps stay "site local", like lesson drip, which
keeps day-based extensions on the same wall-clock time across daylight
saving changes; only the machine-readable value gains the offset that
applies on the due date.

Co-authored-by: brianhogg <brian@brianhogg.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1a296-f04e-701b-bfda-1b9198c59450
Badges are announced as "Status: Overdue" instead of running into the
date, and the syllabus adds hidden punctuation so "Has Quiz, Due: Nov 5,
Status: Overdue." is read as its own phrase before the assignment.

Co-authored-by: brianhogg <brian@brianhogg.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1a296-f04e-701b-bfda-1b9198c59450
Status words, badges, and column headings such as "Late", "Adjusted",
"Item", "Time" and "days" are ambiguous without context.

Co-authored-by: brianhogg <brian@brianhogg.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1a296-f04e-701b-bfda-1b9198c59450
The control was a <details> <summary> styled as a button, so screen
readers didn't announce it as a button or whether its form was open.
It is now a <button> with aria-expanded and aria-controls, and an
accessible name ("Change due date for X") that starts with its visible
text. Opening the form moves focus to the date field, and Escape closes
it and returns focus to the button. "No due date for this student"
disables the date and time fields.

After a save or a validation error, the page returns to the notice and
focuses it so screen readers announce the result; the notice names the
updated item, and a failed item's form stays open.

Co-authored-by: brianhogg <brian@brianhogg.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1a296-f04e-701b-bfda-1b9198c59450
Builder settings showed their label in a <span> that wasn't tied to
the input, so text, number and select fields (including the new Due
Date fields) were announced without a name. Inputs now point at their
label with aria-labelledby, help tips are read as descriptions, and
Select2 comboboxes read the field label before the selected option
("Due, On a specific date" instead of "On a specific date").

Amp-Thread-ID: https://ampcode.com/threads/T-01a1a296-f04e-701b-bfda-1b9198c59450
Co-authored-by: brianhogg <brian@brianhogg.com>

Copy link
Copy Markdown
Contributor Author

Accessibility and translation fixes: before and after

Commits 3160d15…757e929. Student-facing pages look the same; the changes are in what screen readers announce and in keyboard behavior.

Screen reader output (Playwright accessibility tree, course syllabus row):

Before: "Has Quiz Due: Nov 5 Overdue  Has Assignment Due: Nov 10 Due soon"
After:  "Has Quiz, Due: Nov 5, Status: Overdue.  Has Assignment, Due: Nov 10, Status: Due soon."

Machine-readable date: <time datetime="2026-10-25T23:59"> → <time datetime="2026-10-25T23:59:00-04:00">.

"Change" is now a real button (b5ad17e). Opening it with the keyboard moves focus into the form:

Change control opened with the keyboard, before and after

After Save, the page returns to the notice and focuses it, so screen readers announce the result:

After saving, before and after

An invalid date focuses the error and keeps that item's form open:

Validation error after the fix

Course builder labels (757e929): no visual change, but the fields now have names:

Builder Due Date fields, before and after

Before: combobox "On a specific date" · textbox · textbox
After:  combobox "Due On a specific date" · textbox "Date" · textbox "Time (optional)" (described by its help tip)

ampagent and others added 4 commits November 10, 2026 16:00
Due timestamps were "site local" (strtotime() on local dates, compared
to llms_current_time()), which WordPress has discouraged since 5.3.
They are now Unix timestamps compared to time() and formatted with
wp_date():

- Due dates and times set on a quiz or assignment are still entered in
  the site's timezone and converted when read.
- Day-based due dates and profile extensions add calendar days in the
  site's timezone, so 11:59 PM stays 11:59 PM across daylight saving.
- Per-student due dates (and when they were set) are stored in UTC.
- Quiz attempt dates, which core stores in the site's timezone, are
  converted with get_gmt_from_date() before comparing.
- <time datetime> is printed in UTC.

Co-authored-by: brianhogg <brian@brianhogg.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1a296-f04e-701b-bfda-1b9198c59450
The note was an inline <span>, so in themes that replace the LifterLMS
stylesheet (such as Sky Pilot) it ran straight into the "Overdue"
badge. It is now a block element, so it always sits on its own line,
and the text drops "This is past due." since the badge already says so.

Co-authored-by: brianhogg <brian@brianhogg.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1a296-f04e-701b-bfda-1b9198c59450

Copy link
Copy Markdown
Contributor Author

Overdue note on its own line (2ea211d)

The late-submission note was an inline <span> that relied on LifterLMS CSS for display: block. Themes that replace the LifterLMS stylesheet (Sky Pilot) ran it into the "Overdue" badge. It is now a <div>, so it sits on its own line with or without styles, and the text is shorter ("You can still submit it, but it will be marked late."; the badge already says it is overdue). Matching Sky Pilot style: gocodebox/sky-pilot#233.

Checked on the overdue assignment and Quiz Information pages in Sky Pilot, Twenty Twenty-Five and Astra, with and without focus mode, at 1280px and 412px.

Overdue note, before and after

ampagent and others added 4 commits November 12, 2026 14:16
Quiz attempts get late_penalty and late_penalty_note columns. The
penalty is in percentage points, comes off the score calculated from
the questions, and can't be more than the score, so the score is always
the grade plus the penalty. Pass or fail is decided from the final
grade, which stays in the grade column so lesson, course and My Grades
grades include it with no other changes.

The llms_quiz_attempt_late_penalty filter lets a late policy supply the
penalty later.

Co-authored-by: brianhogg <brian@brianhogg.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1a296-f04e-701b-bfda-1b9198c59450
Late quiz attempts get a Late penalty box under the stat tiles where an
instructor sets the penalty in percentage points and an optional note
to the student. It shows the score, penalty and grade, and offers a
Remove penalty button once a penalty is set. If the student's due date
moves so the attempt is no longer late, the box says so.

Saving regrades the attempt through the same steps as saving a review,
now shared in regrade(): the grade is recalculated, completion actions
run, so a pass that becomes a fail sends the quiz failed notification
(and the reverse), and llms_quiz_graded fires. Nothing runs when the
penalty and note didn't change.

Co-authored-by: brianhogg <brian@brianhogg.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1a296-f04e-701b-bfda-1b9198c59450
The student's attempt results list the score and late penalty, plus the
instructor's note, under the grade donut when the attempt has a penalty.
Both quiz attempt tables add a "−35% late" badge after the grade, and the
student quiz attempts export gets Score, Late Penalty and Late Penalty
Note columns.

Co-authored-by: brianhogg <brian@brianhogg.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1a296-f04e-701b-bfda-1b9198c59450
Saving a penalty that drops a passing attempt below the passing grade
fails it and runs the quiz failed and graded actions, saving the same
penalty again runs nothing, and removing it passes the attempt again.
Students can't add one.

Co-authored-by: brianhogg <brian@brianhogg.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1a296-f04e-701b-bfda-1b9198c59450

Copy link
Copy Markdown
Contributor Author

Late penalty (Step 1)

Manual late penalty on late quiz attempts. Applying, changing or removing a penalty regrades the attempt through the same path as saving a review, so a pass that becomes a fail runs lifterlms_quiz_failed (quiz failed notification) and the reverse runs lifterlms_quiz_passed, then llms_quiz_graded. Completion, achievements and certificates are never revoked, matching existing regrade behaviour.

Commits:

  • aa765cb Subtract a late penalty from quiz attempt grades: late_penalty and late_penalty_note columns on lifterlms_quiz_attempts; calculate_grade() takes the penalty off the score, capped at the score, and decides pass/fail from the final grade. get_score(), get_late_penalty(), filter llms_quiz_attempt_late_penalty.
  • 7961cfc Add a late penalty box to the quiz attempt screen: shown for late attempts (or attempts that already have a penalty) to users who can edit the quiz. Shared regrade() used by Save Review and the penalty. Saving an unchanged penalty does nothing.
  • f3d1d62 Show quiz late penalties to students and in reporting: score, penalty and note on the student results; "−35% late" badge in both attempts tables; Score, Late Penalty and Late Penalty Note export columns.
  • c12df33 Test that a quiz late penalty regrades like a review, plus changelog entry.

Late attempt, no penalty yet:
Penalty box

35% penalty applied: 100% → 65%, pass → fail (quiz failed notification sent):
Penalty applied

Due date extended after the penalty, so the attempt is no longer late:
No longer late

Student results, before/after:
Student results

Quiz attempts table:
Attempts table

How It Was Tested

  • PHPUnit: --filter 'Quiz|Lesson|Due' (233 tests) and --filter 'Table|Install|Controller' (481 tests) pass.
  • On a local site: applied 35% to a 100% late attempt; status became Fail and quiz_failed + quiz_graded notifications were created. Removing the penalty restored 100% / Pass and created quiz_passed + quiz_graded.

Quiz attempt responses add read-only score, late_penalty and
late_penalty_note fields, so a client can tell a 60% grade from an 80%
score with a 20 point penalty. The grade field is unchanged and is the
final grade.

Co-authored-by: brianhogg <brian@brianhogg.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1a296-f04e-701b-bfda-1b9198c59450
ampagent and others added 3 commits November 12, 2026 15:02
An attempt with a late penalty exports its score, penalty and the
instructor's note alongside the grade.

Co-authored-by: brianhogg <brian@brianhogg.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1a296-f04e-701b-bfda-1b9198c59450
A penalty saved before the instructor finishes reviewing an attempt is
stored without regrading, so the student isn't told the quiz was graded
when it has no grade yet. Finishing the review regrades the attempt and
applies the penalty. Attempts awaiting review also have no score now,
even if an earlier grade is still stored.

Co-authored-by: brianhogg <brian@brianhogg.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1a296-f04e-701b-bfda-1b9198c59450
The note field fills the box and is three rows tall, so the note isn't
clipped on phones, spacing inside the box is even, and the help text is
shorter.

Co-authored-by: brianhogg <brian@brianhogg.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1a296-f04e-701b-bfda-1b9198c59450

Copy link
Copy Markdown
Contributor Author

Late penalty follow-ups

  • 570a184 Return quiz late penalties from the REST API: read-only score, late_penalty and late_penalty_note on quiz attempt responses. grade is unchanged and is the final grade.
  • b95918d Include quiz late penalties in personal data exports: attempts with a penalty add Score, Late Penalty and Late Penalty Note rows to the Quiz Data export.
  • e60b820 Don't send "quiz graded" for a penalty on an attempt awaiting review: the penalty is stored and applied when the review finishes, which regrades as usual. get_score() returns null until the attempt is pass or fail.
  • 004d6b9 Tidy the late penalty box on small screens.

Advanced Quizzes needs no changes: it only grades individual questions through core filters, and the attempt grade is always calculated by calculate_grade(). Checked with fill-in-the-blank, reorder and long answer questions on a late attempt: penalty saved while pending (no grade, no notification after e60b820), review finished at 75% → 55% Fail with the quiz failed notification, and the REST grade endpoint kept the penalty (50% → 30%).

Penalty box before/after, desktop:
Quiz penalty box desktop

Penalty box before/after, 412px:
Quiz penalty box mobile

How It Was Tested

  • New tests: test_get_item_late_penalty (REST) and test_late_penalty_pending_attempt (fails without e60b820).
  • PHPUnit --filter 'Quiz|Lesson|Due|Controller|Privacy': 553 tests pass.
  • Quiz Data exporter output checked with WP-CLI on a penalized attempt.

brianhogg and others added 3 commits November 12, 2026 10:36
Closing a picker blurred its input, and the picker's own blur handler
closed it again, which blurred again until the stack overflowed, so the
picker never hid. It now only blurs an input that still has focus. The
assignment settings also set up their date pickers, so the assignment
due date and time get a calendar and time list like quizzes.

Co-authored-by: brianhogg <brian@brianhogg.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1a296-f04e-701b-bfda-1b9198c59450

Copy link
Copy Markdown
Contributor Author

Builder date pickers

71f09d8 Close builder date pickers after a date or time is picked.

  • Picker stayed open after picking a date. Closing a picker called $input.blur() in init_datepickers(). The picker's own validateOnBlur handler then closed it again, which blurred again, recursing until the stack overflowed before the picker was hidden. It now blurs only an input that still has focus. The quiz due date and time close after a pick; lesson drip dates use the same code.
  • Assignment due date had no picker. init_datepickers() was commented out in the assignment view, so the assignment Date and Time fields were plain text boxes. The view now sets them up on render and when the settings re-render (for example after changing Due).

Quiz due date, after picking the 20th:
Quiz date picker before/after

Assignment due date, on click:
Assignment date picker before/after

How It Was Tested

  • In the course builder (Playwright, Chromium): quiz due date and time, assignment due date and time (including after switching Due to On a specific date), and lesson drip date each open on click and close after a pick, and the picked values save.
  • Tabbing through a date field keeps its value.
  • Merged the latest poc/due-dates (with dev); PHPUnit --filter 'Quiz|Lesson|Due|Controller|Privacy' (553 tests) passes.

The lesson meta row now wraps with a gap instead of squeezing every item into
a narrow column, and each icon stays on the same line as its label.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1a296-f04e-701b-bfda-1b9198c59450
Co-authored-by: brianhogg <brian@brianhogg.com>

Copy link
Copy Markdown
Contributor Author

Syllabus lesson meta wrapping (1b0b39d)

In narrow syllabus layouts (theme sidebars, mobile), the quiz and assignment meta broke apart: Sky Pilot left the "Has Assignment" icon at the end of one line and its label on the next, and core's non-wrapping flex row squeezed each item into a narrow column, splitting "Due:" from its date and the favorite count from its heart.

  • .llms-lesson-meta now wraps with a gap, which replaces the sibling margin rules.
  • The icon and label are wrapped in .llms-lesson-meta-label and kept on one line, as is .llms-due-date. Items wrap between the label, the due date, and the badge, never inside them.
  • The icons get aria-hidden="true".

Tested with a lesson that has a quiz and an assignment, both showing the longest badge ("Due soon"), in Twenty Twenty-Five, Astra, Kadence and Sky Pilot at 1440px and 412px, in the main content and in a sidebar syllabus widget. Kadence overrides lifterlms/course/lesson-preview.php with an older copy, so its syllabus shows no lesson meta either before or after this change.

Sky Pilot sidebar, before/after:

Sky Pilot sidebar

412px (Twenty Twenty-Five, Astra, Kadence, Sky Pilot sidebar):

412px themes

Desktop after (Twenty Twenty-Five, Sky Pilot, Astra):

Desktop after

brianhogg added a commit that referenced this pull request Nov 12, 2026
The builder's onClose callback blurred the input, and the picker's own
blur handler closed it again, which blurred again until the stack
overflowed. Each pass also re-parsed the time, and the picker stayed
open. Only blur an input that still has focus.

Moved from #3446 (71f09d8) so it can land on dev on its own.
Fixes #3478

Amp-Thread-ID: https://ampcode.com/threads/T-01a1d0e5-6842-727b-b503-7cd82ab90872
Co-authored-by: brianhogg <brian@brianhogg.com>
The fix for the picker's blur/close recursion now lands on dev on its
own in #3479 (#3478). Restore dev's onClose here so
this branch doesn't carry it; merging dev after #3479 brings it back.
The assignment view still sets up its date pickers.

Co-authored-by: brianhogg <brian@brianhogg.com>

Copy link
Copy Markdown
Contributor Author

Builder date picker fix moved to #3479

The onClose recursion fix from 71f09d8 (assets/js/builder/Views/_Editable.js) now lives in #3479, together with the fix for 12-hour times moving back an hour on blur (#3478), so it can land on dev without waiting on this PR. 21cf1ae restores dev's onClose here.

brianhogg added a commit that referenced this pull request Nov 12, 2026
* Fix 12-hour times shifting an hour in builder date pickers

The bundled php-date-formatter 1.3.4 parsed "h:i A" values as
hour + meridiem - 1, so every blur rewrote 02:00 PM as 01:00 PM
(and 12:00 PM as 11:00 PM). Apply upstream's fix from
kartik-v/php-date-formatter@7e5fa68 to both datetimepicker builds,
and version the script with LLMS_ASSETS_VERSION so browsers load the
patched file.

Fixes #3478

Amp-Thread-ID: https://ampcode.com/threads/T-01a1d0e5-6842-727b-b503-7cd82ab90872
Co-authored-by: brianhogg <brian@brianhogg.com>

* Only blur a focused input when a builder date picker closes

The builder's onClose callback blurred the input, and the picker's own
blur handler closed it again, which blurred again until the stack
overflowed. Each pass also re-parsed the time, and the picker stayed
open. Only blur an input that still has focus.

Moved from #3446 (71f09d8) so it can land on dev on its own.
Fixes #3478

Amp-Thread-ID: https://ampcode.com/threads/T-01a1d0e5-6842-727b-b503-7cd82ab90872
Co-authored-by: brianhogg <brian@brianhogg.com>

---------

Co-authored-by: Amp <amp@ampcode.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Awaiting Review

Development

Successfully merging this pull request may close these issues.

2 participants