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

Questionnaire freetext question: ignorerepl option must support Scala 3 output #134

Closed
markkuriekkinen opened this issue Aug 1, 2022 · 1 comment
Assignees
Labels
area: grading quizzes Quiz feature effort: hours The issue seems to be small and should be doable in hours or few days. experience: beginner required knowledge estimate requester: internal The issue is raised by a person inside the A+ team type: bug This is a bug.

Comments

@markkuriekkinen
Copy link
Member

From the O1 course:

The "ignorerepl" switch for questionnaire items means that students are
allowed to answer entire lines of text copy-pasted from the Scala REPL
even though the question just asks for a single element from that line.

For example, a question may ask the students to use the REPL to
determine a certain integer result. If the question is marked as
"int-ignorerepl", then the student may either answer with the integer
itself (say, 123456) or they may paste in the entire line from the Scala
REPL that they used to determine the result, such as this:

res0: Int = 123456

Now, the above was thrown in years ago when the questionnaire directive
was first created for O1’s purposes. It’s a bit of a hack, since it’s
language-specific, but it has worked fine. However, since the recent
introduction of Scala 3, the REPL output has changed, and there’s a
"val" in front of such outputs. Like this:

val res0: Int = 123456

So I would be happy if that format was additionally/alternatively
supported (i.e., ignored for grading purposes).

(I suppose the best solution would be to make this configurable somehow,
so that it wouldn’t be Scala-specific. But I’d be OK with a
quick-and-dirty fix too.)

Private ticket:
https://rt.cs.aalto.fi/Ticket/Display.html?id=21634


I think this regex is the one that grades these inputs. Currently, it doesn't seem to allow whitespace (val res0 contains a space) in the start before the colon :.

if "ignorerepl" in mods:
p = re.compile('(^\w+:\s[\w\.\[\]]+\s=)')
m = p.match(val)
if m:
val = val[len(m.group(1)):].strip()

@markkuriekkinen markkuriekkinen added type: bug This is a bug. area: grading quizzes Quiz feature effort: hours The issue seems to be small and should be doable in hours or few days. experience: beginner required knowledge estimate requester: internal The issue is raised by a person inside the A+ team labels Aug 1, 2022
@markkuriekkinen markkuriekkinen self-assigned this Aug 4, 2022
@markkuriekkinen
Copy link
Member Author

markkuriekkinen commented Aug 4, 2022

I think this regex is the one that grades these inputs.

More precisely, it removes the REPL part from the value so that only the actual value is compared to the model solution.
For example, both res0: Int = 123456 and val res0: Int = 123456 should become just 123456 which is compared to the model solution. The model solution defined by the teacher in the configuration could be simply 123456.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: grading quizzes Quiz feature effort: hours The issue seems to be small and should be doable in hours or few days. experience: beginner required knowledge estimate requester: internal The issue is raised by a person inside the A+ team type: bug This is a bug.
Projects
Status: Done
Development

No branches or pull requests

1 participant