Repository navigation
Conversation
eac2f66 to
c4a1eea
Compare
|
The e2e test fix I just implemented was accidentally on this branch so I removed it, sorry for the confusion. I'll create a separate PR for it |
ihalaij1
left a comment
There was a problem hiding this comment.
Here is what an AI review found:
Bugs
1. Fuzzy translation entries will show raw msgids to users (verified)
MODULE_ERROR_EARLY_SUBMISSION_DL_BEFORE_OPENING_TIME is marked #, fuzzy in both locale/en/LC_MESSAGES/django.po (line 815) and locale/fi/LC_MESSAGES/django.po (line 820), with the msgstr copied from the AFTER_CLOSING_TIME variant. I compiled and inspected the .mo catalog: fuzzy entries are excluded by msgfmt, so at runtime gettext returns the raw msgid. When a teacher sets an early deadline before the opening time, the form will literally display MODULE_ERROR_EARLY_SUBMISSION_DL_BEFORE_OPENING_TIME instead of a sentence. The Finnish msgstr is also semantically wrong ("tulee olla ennen moduulin sulkeutumisaikaa" — should say the deadline must be after the opening time). Fix: remove the #, fuzzy + #| lines and correct both msgstrs.
2. Unrelated behavior change: scale_grade_to no longer caps at max points
exercise/submission_models.py removed self.grade = min(self.grade, self.exercise.max_points) from scale_grade_to(). This is needed to keep bonus grades intact when scaling to 100% (and is tested), but it is an undocumented, unrelated change bundled into the PR. It also changes the behavior of the scale_grade_to management command (course/management/commands/scale_grade_to.py): previously scaling could never push a grade above exercise.max_points; now grades already above max (bonus grades) stay above it after any scaling. This should at least be called out in the PR description, and ideally separated into its own commit/PR.
3. configure.py unconditionally resets early_submission_bonus_in_use
In edit_course/operations/configure.py:
module.early_submission_bonus_in_use = parse_bool(m.get("early_bonus_in_use", False))Unlike every other field in that block (only set if "key" in m), this always overwrites the flag. Consequence: if a teacher configures the bonus via the Edit course UI and someone later re-runs course configuration from a YAML that doesn't contain early_bonus_in_use (older config, hand-edited YAML, another tool), the bonus is silently disabled while early_submission_deadline, early_submission_bonus and bonus_time_step_hours are all preserved. That asymmetry (values persist, flag resets) is surprising and is a data-loss gotcha. The test test_early_submission_bonus actually codifies this behavior, so if it's intentional it should be documented; otherwise it should follow the same if "early_bonus_in_use" in m: pattern as the neighbors.
4. percent filter truncation can misdisplay the bonus
The notice uses {{ module.early_submission_bonus|percent }} where percent() is int(decimal * 100). Floating point makes e.g. 0.29 * 100 = 28.999999999999996 → the exercise page would advertise "28% more points" for a 0.29 bonus. Pre-existing filter, but the new feature is exposed to it. (The tooltip code in course_forms.py correctly uses f'{x:.2f}' rounding instead.)
Design / consistency concerns
5. Bonus notice ignores personal deadline deviations. exercise_plain.html shows "X% more points if submitted before {{ module.early_submission_deadline }}" — the module-wide deadline. The adjacent deadline display carefully handles summary.personal_deadline, but the bonus notice doesn't. A student with an extension sees a bonus cutoff that doesn't reflect their situation (students with extensions submitting after module closing_time get no bonus at all, since the tier is 0 past closing — reasonable, but undocumented and untested).
6. Tooltip math is duplicated and can go stale. CourseModuleForm.__init__ re-implements the taper calculation (full_steps, decrease per step) that also lives in CourseModule.get_early_submission_bonus_tier. If the model math changes, the tooltip drifts. Also, the tooltip is computed from the saved instance, so on a validation-error re-render it describes the old DB values, not what the teacher just typed. Consider a model helper (e.g. returning taper info) reused by the form.
7. Required early_submission_deadline even when the bonus is off. The model field is blank=False (only a default), so the ModelForm field is always required in the SCHEDULE fieldset. It's pre-filled so it passes, but teachers who don't use the bonus still must submit a value for a field that is ignored. A form clean() making it optional when early_submission_bonus_in_use is unchecked would be cleaner.
8. Minor wording in the taper tooltip. "The bonus decreases by 5 percentage points per step from 15% to 0%" — the first tapered step is actually 10% (the full 15% only applies before the early deadline). The range 15→0 describes the decrease, but reads as if the first step gives 15%.
Style / process
configure()still doesn't catchValidationErrorfrommodule.full_clean()(pre-existing), but the new fields add new ways to crash it: an out-of-rangeearly_bonusor negativebonus_time_step_hourscoming from a non-RST source (hand-written YAML / gitmanager) raises an unhandledValidationErrorinstead of landing in theerrorslist. The RST side validates (nonnegative_int), the JSON side doesn't.
|
Added new commit to address the above-mentioned issues. Here's a breakdown:
|
UX improvements for the early submission bonus system
|
Fixed unit and e2e tests that were failing due to recent changes. Also fixed a bug in which module edits couldn't be saved in the UI if a late submission penalty is configured without an early submission bonus. Also changed the minimum increment for the bonus/penalty from 0.1 to 0.01. |
Description
What?
Implement early submission bonus functionality in a-plus. This adds the possibility of adding early submission bonuses to modules and their corresponding deadlines, as well as bonus tapering.
Why?
This is a feature request, issue #1401
How?
Using the previously added four new database fields, implement the bonus functionality. The bonus can be edited both via module RST and the 'Edit course' page, which contains explanatory tooltips for especially the rather complex bonus tapering functionality. Information about the bonus is also shown to students in the affected exercises, if the bonus is currently available.
Testing
Remember to add or update unit tests for new features and changes.
What type of test did you run?
Tested manually both the 'normal' early bonus and tapering steps via manual course editing and submitting questionnaire exercises.
Did you test the changes in
Think of what is affected by these changes and could become broken
Translation
Programming style
Have you updated the README or other relevant documentation?
Aplus-manual edits in another PR
Is it Done?
Clean up your git commit history before submitting the pull request!