Skip to content

Term start date warnings for students - #1479

Open
ascholerChemeketa wants to merge 5 commits into
RunestoneInteractive:mainfrom
ascholerChemeketa:term-start-date-warnings
Open

Term start date warnings for students#1479
ascholerChemeketa wants to merge 5 commits into
RunestoneInteractive:mainfrom
ascholerChemeketa:term-start-date-warnings

Conversation

@ascholerChemeketa

Copy link
Copy Markdown
Contributor

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:

  • Added term_start_date to context in backend endpoints and exposed it in eBookConfig for frontend use, enabling the system to determine if the course has started for the current user. [1] [2] [3]
  • Implemented frontend logic (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:

  • Refactored the progress bar markup across templates and tests to use a consistent structure with a dedicated scprogress-activity-count container, improving accessibility and maintainability. [1] [2] [3]
  • Ensured that on PTX-generated pages, the progress bar container is forcibly re-rendered to avoid stale markup.
  • Added margin styling to progress bar elements and warning messages for improved layout and visibility. [1] [2]

Instructor and Course Setup Guidance:

  • Updated course creation and settings forms to clarify the meaning of the term start date, explicitly stating that student work before this date will not be counted. Added ARIA hints for accessibility. [1] [2]

Template and Configuration Enhancements:

  • Ensured that the ebook_config.html partial is included where necessary so that frontend scripts have access to the correct configuration, including the course start date.

Copilot AI lite review requested due to automatic review settings September 5, 2026 18:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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_date in backend contexts and in frontend eBookConfig so 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

  • courseNotStartedMessage formats the term start date via new 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.

Comment on lines +351 to +359
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;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think this is OK.

Term start date is known to be this format.
Public books are still "courses" with a term start date.

Comment on lines +462 to +466
let progressText = document.getElementById("scprogress-activity-count");
// Warn if course not started
if(progressText && !isCourseStarted()) {
progressText.appendChild(document.createTextNode(courseNotStartedMessage()));
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renderProgress expectation is to only call once

Comment thread bases/rsptx/interactives/runestone/common/js/bookfuncs.js
Comment on lines +1143 to +1147
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();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Role alert here is not appropriate - we do not want it to be that assertive.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated wording

Copilot AI review requested due to automatic review settings September 5, 2026 19:03
@ascholerChemeketa

Copy link
Copy Markdown
Contributor Author

Force pushed with edits noted above

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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() assumes eBookConfig.termStartDate is always present/valid; when it is missing or empty (e.g. defaulting to "" in templates or unit tests that set only isLoggedIn), 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

Comment on lines +462 to +466
let progressText = document.getElementById("scprogress-activity-count");
// Warn if course not started
if(progressText && !isCourseStarted()) {
progressText.appendChild(document.createTextNode(courseNotStartedMessage()));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants