Skip to content

Conversation

PhilippImhof
Copy link
Collaborator

This PR will add the following:

  • For each part, teachers can decide whether or not that part should accept empty answers.
  • For fields that the student is expected to leave empty, they will be able to define a special model answer. The current idea is $EMPTY. (This concept is borrowed from the excellent STACK plugin, because the people over there are much smarter than I am.)
  • If the part is configured to allow empty fields, it will be considered complete regardless of the number of fields that have been filled. (Therefore, there will be no error if the student clicks "Check" in adaptive mode and one or even all fields have been left empty.)
  • If the student enters any value into a field that should have been empty, that will give the largest possible difference PHP_FLOAT_MAX. The same happens if the student leaves empty a field that is not supposed to be empty. If both the model and the student answer are empty, the difference is 0.
  • For the custom grading criterion, I will add a function is_empty() or something the like, in order for the teacher to be able to check for an empty response.

This is currently in a very early stage and should absolutely not be installed on any production server.

@PhilippImhof PhilippImhof added this to the 6.2.0 milestone Jul 28, 2025
@PhilippImhof PhilippImhof self-assigned this Jul 28, 2025
@PhilippImhof PhilippImhof linked an issue Jul 28, 2025 that may be closed by this pull request
@PhilippImhof PhilippImhof force-pushed the allow-empty-fields branch 5 times, most recently from db98b18 to 220db49 Compare August 1, 2025 19:29
@PhilippImhof
Copy link
Collaborator Author

Tests are now passing. This means, the implementation of the new functionality should now no longer break any existing stuff.

However, stuff is still not ready yet, because I haven't implemented the tests that actually check whether the new feature really works in various conditions.

@coveralls
Copy link

coveralls commented Aug 2, 2025

Pull Request Test Coverage Report for Build 17019138792

Details

  • 78 of 92 (84.78%) changed or added relevant lines in 10 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.2%) to 97.399%

Changes Missing Coverage Covered Lines Changed/Added Lines %
classes/local/token.php 1 2 50.0%
questiontype.php 9 10 90.0%
renderer.php 4 5 80.0%
backup/moodle2/restore_qtype_formulas_plugin.class.php 2 4 50.0%
classes/local/answer_parser.php 7 9 77.78%
question.php 20 22 90.91%
classes/local/evaluator.php 17 22 77.27%
Totals Coverage Status
Change from base Build 16770520117: -0.2%
Covered Lines: 4381
Relevant Lines: 4498

💛 - Coveralls

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

Successfully merging this pull request may close these issues.

Allow grading in parts with empty input.
2 participants