Skip to content

[Bugfix:InstructorUI] Create Course Validation#12949

Merged
bmcutler merged 2 commits into
mainfrom
course-creation-title-validation
Jun 24, 2026
Merged

[Bugfix:InstructorUI] Create Course Validation#12949
bmcutler merged 2 commits into
mainfrom
course-creation-title-validation

Conversation

@NicholasCiuica

@NicholasCiuica NicholasCiuica commented Jun 24, 2026

Copy link
Copy Markdown
Member

Why is this Change Important & Necessary?

Closes #12934

What is the New Behavior?

If a user tries to make a new course and inputs a course code containing characters other than lowercase letters, numbers, or underscores, they will be redirected to the New Course page and be given a helpful error. This validation is implemented server-side. Previously, there was no validation for the course code field.

What steps should a reviewer take to reproduce or test the bug or new feature?

  1. On main, sign in as instructor.
  2. Go to the New Course page.
  3. Ensure the term is valid and select any filesystem group.
  4. Enter a valid course code (containing only lowercase letters, numbers, and underscores) and click Create New Course.
  5. You will see the popup below, and after a few seconds and a reload, the new course appears under My Courses.
Screenshot 2026-06-19 152318
  1. Repeat steps 2 and 3, then try to enter a course code that does not follow the requirements given for that field
    (e.g. "!", " ", "A", "te st").
  2. You will see the same message pop up as in step 5, but the course is never made.

Now go to this PR's branch and repeat the above procedure. After entering an invalid course code and trying to create a new course, instead of seeing the green popup, you will be redirected to the New Course page and will see this red popup:

Screenshot 2026-06-24 105327

Automated Testing & Documentation

Introduced in issue #12951

@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 21.40%. Comparing base (1b8b7cb) to head (dc9e349).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main   #12949      +/-   ##
============================================
- Coverage     21.41%   21.40%   -0.01%     
- Complexity     9942     9944       +2     
============================================
  Files           268      268              
  Lines         37116    37124       +8     
  Branches        494      494              
============================================
  Hits           7948     7948              
- Misses        28678    28686       +8     
  Partials        490      490              
Flag Coverage Δ
autograder 21.16% <ø> (ø)
js 2.01% <ø> (ø)
migrator 100.00% <ø> (ø)
php 20.44% <0.00%> (-0.01%) ⬇️
python_submitty_utils 80.08% <ø> (ø)
submitty_daemon_jobs 91.13% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dandrecollins07-ctrl dandrecollins07-ctrl 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.

Code works and fixed the issue on frontend wise, however the course still is created on the backend.

Possible fix in a PHP file.

Tested via: ls /var/local/submitty/courses/s26

@github-project-automation github-project-automation Bot moved this from Seeking Reviewer to Work in Progress in Submitty Development Jun 24, 2026

@dandrecollins07-ctrl dandrecollins07-ctrl 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.

After extensive re-testing the invalid course code behavior on the PR branch. Invalid course codes now redirect back to the New Course page with the red error message, and a fresh invalid course attempt did not create a course directory or database row. Valid course creation still works. Approving.

@github-project-automation github-project-automation Bot moved this from Work in Progress to Awaiting Maintainer Review in Submitty Development Jun 24, 2026
@bmcutler
bmcutler merged commit 75511e4 into main Jun 24, 2026
28 checks passed
@bmcutler
bmcutler deleted the course-creation-title-validation branch June 24, 2026 18:53
@github-project-automation github-project-automation Bot moved this from Awaiting Maintainer Review to Done in Submitty Development Jun 24, 2026
jndlansh pushed a commit to jndlansh/Submitty that referenced this pull request Jul 1, 2026
### Why is this Change Important & Necessary?
Closes Submitty#12934 

### What is the New Behavior?
If a user tries to make a new course and inputs a course code containing
characters other than lowercase letters, numbers, or underscores, they
will be redirected to the New Course page and be given a helpful error.
This validation is implemented server-side. Previously, there was no
validation for the course code field.

### What steps should a reviewer take to reproduce or test the bug or
new feature?
1. On main, sign in as instructor.
2. Go to the New Course page.
3. Ensure the term is valid and select any filesystem group.
4. Enter a valid course code (containing only lowercase letters,
numbers, and underscores) and click Create New Course.
5. You will see the popup below, and after a few seconds and a reload,
the new course appears under My Courses.

<img width="385" height="83" alt="Screenshot 2026-06-19 152318"
src="https://github.com/user-attachments/assets/8254bd1b-a223-4cd3-897d-fe6d89e53293"
/>

6. Repeat steps 2 and 3, then try to enter a course code that does not
follow the requirements given for that field
(e.g. "!", "   ", "A", "te st").
7. You will see the same message pop up as in step 5, but the course is
never made.

Now go to this PR's branch and repeat the above procedure. After
entering an invalid course code and trying to create a new course,
instead of seeing the green popup, you will be redirected to the New
Course page and will see this red popup:

<img width="395" height="73" alt="Screenshot 2026-06-24 105327"
src="https://github.com/user-attachments/assets/bdfae72e-45d7-42b3-a434-965dc0e3f123"
/>

### Automated Testing & Documentation
Introduced in issue Submitty#12951
prestoncarman added a commit that referenced this pull request Jul 1, 2026
* main: (78 commits)
  [Bugfix:TAGrading] Auto-open single file (#12625)
  [Feature:InstructorUI] Add sortable columns to manage students (#12957)
  [Dependency] Bump php-ds/php-ds from 1.7.0 to 2.0.1 in /site (#12827)
  [Refactor:TAGrading] Events Infrastructure & StatusBanner (#12941)
  [Dependency] Bump sqlalchemy from 2.0.48 to 2.0.51 in /.setup/pip (#12884)
  [Bugfix:Developer] trust hashicorp for vagrant install (#12968)
  [Feature:TAGrading] Backend for submission clustering (#12886)
  [Bugfix:InstructorUI] Missing Subsection in the Edit User form (#12955)
  [Bugfix:Submission] Warning Banners Accessibility Fix (#12956)
  [Bugfix:System] Preserve signup fields (#12939)
  [Bugfix:InstructorUI] Fix Csv Download of Subsections (#12954)
  [Bugfix:InstructorUI] Fix Manage Students Toggle Columns (#12953)
  [Feature:TAGrading] Persistent Auto-Open (#12931)
  [Bugfix:Submission] Dot File Upload (#12924)
  [Refactor:System] Declutter workers (#12815)
  [Bugfix:Developer] save/restore autograding_containers.json (#12952)
  [Bugfix:InstructorUI] Create Course Validation (#12949)
  [Testing:Notifications] Fix grade_inquiries.spec.js (#12950)
  [UI/UX:System] Add fullscreen button vue component (#12936)
  [Bugfix:TAGrading] Student Name Resize (#12946)
  ...

# Conflicts:
#	.pylintrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[Bug:InstructorUI] Create Course No Validation

3 participants