|
| 1 | +""" |
| 2 | +Canonical option lists ("values") for course-level Advanced Settings fields |
| 3 | +that should be presented as dropdowns in Studio. |
| 4 | +
|
| 5 | +These describe the valid choices for enum-like course settings so the Advanced |
| 6 | +Settings API can expose them to the frontend, instead of the frontend |
| 7 | +hardcoding them. Each list follows the XBlock ``values`` format: |
| 8 | +``[{"display_name": ..., "value": ...}, ...]``. |
| 9 | +
|
| 10 | +``display_name`` values are plain strings (not wrapped in gettext) for two |
| 11 | +reasons: this module is imported by ``xmodule/modulestore/inheritance.py``, |
| 12 | +which explicitly forbids importing Django, and the existing enum ``values`` in |
| 13 | +``xmodule/course_block.py`` already use plain-string labels. User-facing |
| 14 | +translation of these labels is handled by the frontend. |
| 15 | +
|
| 16 | +NOTE: ``showanswer`` / ``rerandomize`` / ``show_correctness`` also exist as |
| 17 | +problem-level fields in ``xmodule/capa_block.py`` with their own inline |
| 18 | +``values``. Those should eventually be migrated to reference these constants so |
| 19 | +there is a single source of truth. They are mirrored here (matching the |
| 20 | +SHOWANSWER / RANDOMIZATION / ShowCorrectness constants) to keep this module |
| 21 | +dependency-light and avoid import cycles. |
| 22 | +""" |
| 23 | + |
| 24 | +# Mirrors SHOWANSWER in xmodule/capa_block.py |
| 25 | +SHOWANSWER_FIELD_OPTIONS = [ |
| 26 | + {"display_name": "Always", "value": "always"}, |
| 27 | + {"display_name": "Answered", "value": "answered"}, |
| 28 | + {"display_name": "Attempted or Past Due", "value": "attempted"}, |
| 29 | + {"display_name": "Closed", "value": "closed"}, |
| 30 | + {"display_name": "Finished", "value": "finished"}, |
| 31 | + {"display_name": "Correct or Past Due", "value": "correct_or_past_due"}, |
| 32 | + {"display_name": "Past Due", "value": "past_due"}, |
| 33 | + {"display_name": "Never", "value": "never"}, |
| 34 | + {"display_name": "After Some Number of Attempts", "value": "after_attempts"}, |
| 35 | + {"display_name": "After All Attempts", "value": "after_all_attempts"}, |
| 36 | + {"display_name": "After All Attempts or Correct", "value": "after_all_attempts_or_correct"}, |
| 37 | + {"display_name": "Attempted", "value": "attempted_no_past_due"}, |
| 38 | +] |
| 39 | + |
| 40 | +# Mirrors RANDOMIZATION in xmodule/capa_block.py |
| 41 | +RERANDOMIZE_FIELD_OPTIONS = [ |
| 42 | + {"display_name": "Always", "value": "always"}, |
| 43 | + {"display_name": "On Reset", "value": "onreset"}, |
| 44 | + {"display_name": "Never", "value": "never"}, |
| 45 | + {"display_name": "Per Student", "value": "per_student"}, |
| 46 | +] |
| 47 | + |
| 48 | +# Mirrors ShowCorrectness in the xblock.scorable library |
| 49 | +SHOW_CORRECTNESS_FIELD_OPTIONS = [ |
| 50 | + {"display_name": "Always", "value": "always"}, |
| 51 | + {"display_name": "Never", "value": "never"}, |
| 52 | + {"display_name": "Past Due", "value": "past_due"}, |
| 53 | +] |
| 54 | + |
| 55 | +# Mirrors CertificatesDisplayBehaviors in xmodule/data.py |
| 56 | +CERTIFICATES_DISPLAY_BEHAVIOR_FIELD_OPTIONS = [ |
| 57 | + {"display_name": "End of course", "value": "end"}, |
| 58 | + {"display_name": "End of course, with date", "value": "end_with_date"}, |
| 59 | + {"display_name": "Immediately upon earning", "value": "early_no_info"}, |
| 60 | +] |
0 commit comments