Term start date warnings for students - #1479
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The new course-start detection and warning rendering have correctness/accessibility issues (timezone-sensitive date parsing, missing base alert class/semantics, and overly broad progress container overwrites) that should be fixed before merge.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adds term start date awareness to the student experience by exposing the course term start date to frontend config and using it to display “course not started yet” warnings, while also standardizing progress bar markup across templates/tests and improving instructor-facing guidance text.
Changes:
- Expose
term_start_datein backend contexts and in frontendeBookConfigso client code can determine whether a course has started. - Add client-side warnings (progress bar + PTX page alert) when a student views content before the term start date, and force progress bar markup re-rendering for PTX pages.
- Standardize progress bar markup structure and adjust related styling/layout.
File summaries
| File | Description |
|---|---|
| components/rsptx/templates/common/ebook_config.html | Adds termStartDate to eBookConfig for non-PTX templates that include this partial. |
| components/rsptx/templates/assignment/student/chooseAssignment.html | Ensures ebook_config.html is included when not using the PTX base template. |
| components/rsptx/templates/admin/instructor/create_course.html | Adds ARIA hinting and clarifies term start date guidance text. |
| components/rsptx/templates/admin/instructor/course_settings.html | Updates term start date description text in course settings UI. |
| bases/rsptx/interactives/runestone/common/test/bookfuncs_progress.test.js | Updates test fixture markup for the new progress bar structure. |
| bases/rsptx/interactives/runestone/common/project_template/_templates/plugin_layouts/sphinx_bootstrap/layout.html | Refactors progress bar markup to use the new activity-count container. |
| bases/rsptx/interactives/runestone/common/js/bookfuncs.js | Adds course-start checks and warning rendering; re-renders progress markup for PTX pages. |
| bases/rsptx/interactives/runestone/common/css/runestone.css | Adds styling for the course-not-started warning container. |
| bases/rsptx/interactives/public/index.html | Updates public index progress bar markup to match the new structure. |
| bases/rsptx/interactives/ptxrs-bootstrap.less | Adds margin adjustments to progress bar styling. |
| bases/rsptx/assignment_server_api/routers/student.py | Passes term_start_date through to student template contexts. |
Review details
Suppressed comments (1)
bases/rsptx/interactives/runestone/common/js/bookfuncs.js:365
courseNotStartedMessageformats the term start date vianew Date(eBookConfig.termStartDate), which has the same UTC parsing issue as above and can display the wrong calendar date in some timezones (or "Invalid Date" if the value is empty).
function courseNotStartedMessage() {
const formattedDate = new Date(eBookConfig.termStartDate).toLocaleDateString(undefined, {
year: 'numeric',
month: 'long',
day: 'numeric'
- Files reviewed: 11/11 changed files
- Comments generated: 6
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| export function isCourseStarted() { | ||
| let startDate = eBookConfig.termStartDate; // format is "2026-09-22" | ||
| if (!startDate) { | ||
| return false; | ||
| } | ||
| let today = new Date(); | ||
| let start = new Date(startDate); | ||
| return today >= start; | ||
| } |
There was a problem hiding this comment.
Think this is OK.
Term start date is known to be this format.
Public books are still "courses" with a term start date.
| let progressText = document.getElementById("scprogress-activity-count"); | ||
| // Warn if course not started | ||
| if(progressText && !isCourseStarted()) { | ||
| progressText.appendChild(document.createTextNode(courseNotStartedMessage())); | ||
| } |
There was a problem hiding this comment.
renderProgress expectation is to only call once
| const warningContainer = document.createElement("div"); | ||
| warningContainer.className = "ptx-runestone-container"; | ||
| const warningDiv = document.createElement("div"); | ||
| warningDiv.className = "course-not-started-warning alert-danger"; | ||
| warningDiv.textContent = courseNotStartedMessage(); |
There was a problem hiding this comment.
Role alert here is not appropriate - we do not want it to be that assertive.
There was a problem hiding this comment.
Added alert class
| <label for="start_date">Term Start Date</label> | ||
| <input type="text" id="start_date" value="{{ start_date }}" onchange="updateCourse(this, 'new_date')"> | ||
| <div class="setting-description">Set the start date for your course term</div> | ||
| <div class="setting-description">Set this to the first day students will be able to access the course. Student work before this date will not be counted.</div> |
There was a problem hiding this comment.
Updated wording
| <label for="startdate">Term start date</label> | ||
| <input type="date" name="startdate" id="startdate" class="form-control" required value="{{ submitted.startdate if submitted is defined else current_date }}"> | ||
| <input type="date" name="startdate" id="startdate" class="form-control" required value="{{ submitted.startdate if submitted is defined else current_date }}" aria-describedby="startdate-hint"> | ||
| <small class="form-text text-muted" id="startdate-hint">Set this to the first day students will be able to access the course. Student work before this date will not be counted.</small> |
There was a problem hiding this comment.
Updated wording
24c2666 to
ab889db
Compare
|
Force pushed with edits noted above |
There was a problem hiding this comment.
🟡 Changes recommended
The new warning message formatting can throw when termStartDate is missing/empty, which risks breaking page setup/progress rendering and tests.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (2)
bases/rsptx/interactives/runestone/common/js/bookfuncs.js:1141
- This top-of-page alert is currently shown for any logged-in user. The PR description says the warning is for students accessing content before the term start date; consider suppressing it for instructors to avoid confusing course staff who preview content early.
if (!isCourseStarted()) {
bases/rsptx/interactives/runestone/common/js/bookfuncs.js:365
courseNotStartedMessage()assumeseBookConfig.termStartDateis always present/valid; when it is missing or empty (e.g. defaulting to "" in templates or unit tests that set onlyisLoggedIn),new Date(...).toLocaleDateString(...)can throw a RangeError and break page setup/progress rendering. Add a validity guard and a fallback message/date formatting.
function courseNotStartedMessage() {
const formattedDate = new Date(eBookConfig.termStartDate).toLocaleDateString(undefined, {
year: 'numeric',
month: 'long',
day: 'numeric'
- Files reviewed: 11/11 changed files
- Comments generated: 1
- Review effort level: Lite
| let progressText = document.getElementById("scprogress-activity-count"); | ||
| // Warn if course not started | ||
| if(progressText && !isCourseStarted()) { | ||
| progressText.appendChild(document.createTextNode(courseNotStartedMessage())); | ||
| } |
Inform instructors that Term Start Date is first day student work is tracked.
Adds warnings to students if they access book/assignments before TermStartDate.
This pull request introduces several improvements related to course term start dates and student progress tracking, particularly enhancing how and when student work is counted and displayed. It adds clearer messaging and UI feedback for students about whether their course has started, ensures consistent progress bar rendering, and improves accessibility and guidance in course setup forms.
Course Term Start Date Handling and Messaging:
term_start_dateto context in backend endpoints and exposed it ineBookConfigfor frontend use, enabling the system to determine if the course has started for the current user. [1] [2] [3]isCourseStarted,courseNotStartedMessage) to check the course start date and display a warning if the course has not yet begun. This warning appears both in the progress bar area and as a prominent alert at the top of PTX-generated pages. [1] [2] [3]Progress Bar and UI Consistency:
scprogress-activity-countcontainer, improving accessibility and maintainability. [1] [2] [3]Instructor and Course Setup Guidance:
Template and Configuration Enhancements:
ebook_config.htmlpartial is included where necessary so that frontend scripts have access to the correct configuration, including the course start date.