Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assignments_ids with () in them fail in formgrader #1738

Open
perllaghu opened this issue Mar 2, 2023 · 1 comment
Open

Assignments_ids with () in them fail in formgrader #1738

perllaghu opened this issue Mar 2, 2023 · 1 comment

Comments

@perllaghu
Copy link
Contributor

Discovered when using notebook: 6.4.11 and nbgrader: 0.7.1 under linux

Tested & confirmed using notebook: 6.4.12 and nbgrader: 0.8.1 under linux

Expected behavior

When collecting notebooks known to be submitted, the # Submissions column should give a value, and a link to be able to grade submissions

Actual behavior

When collecting notebooks known to be submitted, the # Submissions column remains 0

Cause of the behavior

There are a number of places that use regexp to disassemble a path to find details of course-code, assignment-code, student-code, and/or notebooks.

There is a problem if any of those elements have characters in them that can be interpreted as a "regex special character" [. $ * + ? {} \ [] | () ... and various combinations involving the above.]

For example, if an assignment is called 123 (abc) - it will happily flow through the system, however formgrader will always count 0 students as NbGrader.api.get_submitted_students() has a regexp <snip>/submitted/(?P<student_id>.*)/123 (abc) ... and this matches 123 abc, with the abc in a MatchObject, *not 123 (abc)

Tested solution

Increase the number of characters tested for validation in assignment_id

  • Edit server_extensions/formgrader/static/js/manage_assignments.js in the var createAssignment section (used in the formgrader UI)
  • Edit coursedir.py in def _validate_assignment_id(.. (needed for the CLI commands)

I suggest the following characters will confuse the regexp system, and should be excluded: +()/\\[]{}$^

@perllaghu
Copy link
Contributor Author

perllaghu commented Mar 18, 2023

After coming across people who use braces and slashes in course codes.... I've changed a tack on this: convert relevant low ASCII characters into high-order equivalent Unicode characters.

This actually drops the clause that assignments can't have +.... we transform it to (Heavy Plus Sign U+2795)

so, in theory, abc (12/34*) + {not|really?}[^e$] becomes abc (12∕34★) ➕ {not❘really❔}[^e$] :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants