apluslms / a-plus-rst-tools

Tools to publish RST course content for mooc-grader and a-plus. Should be cloned as a course submodule.
MIT License
6 stars 24 forks source link

The exercise configure files setting does not work in multilingual courses that use different file paths for the languages #149

Closed markkuriekkinen closed 2 years ago

markkuriekkinen commented 2 years ago

A multilingual course could, for example, use different directories in the container.mount setting for each language so that localized unit tests could be run for each language. (In practice in the course git repo, the exercise directory could have subdirectories en and fi that are used in the container.mount setting.) The mount paths are automatically added to the configure.files exercise setting. A-plus-rst-tools are not currently able to combine the language versions in the configure setting.

The different configure.files values could look like this:

{'files': {'exercises/ex_clubpoints/fi': 'exercises/ex_clubpoints/fi'}}
{'files': {'exercises/ex_clubpoints/en': 'exercises/ex_clubpoints/en'}}

Since the files dictionaries are not identical, a-plus-rst-tools raises warnings here: https://github.com/apluslms/a-plus-rst-tools/blob/bf5398042b61b861ad46f1cf4a5bc5809ea2dcad/lib/toc_languages.py#L165-L168

Idea for the fix

Merge the configure.files dictionaries so that all values from all languages are listed in the same one dictionary. There are other settings that use the key suffix |i18n and a nested dictionary with the language codes as keys (en, fi) (an example below), but that approach does not fit to the configure field. The configure field should simply list all files and directories that are copied to the grader.

This approach should not be used in the configure field:

somekey|i18n:
    en: English value
    fi: Finnish value

But this is good:

configure:
    url: http://grader/configure
    files:
        "exercises/ex_clubpoints/fi": "exercises/ex_clubpoints/fi"
        "exercises/ex_clubpoints/en": "exercises/ex_clubpoints/en"

Internal ticket: https://rt.cs.aalto.fi/Ticket/Display.html?id=21497

markkuriekkinen commented 2 years ago

This issue is more visible after the commit https://github.com/apluslms/a-plus-rst-tools/commit/3063783cee52477f8086b2733957705220217f2a because that commit removed the early return in the function set_configure() when there is no manually set configure URL. After that commit, the configure field is really output in the yaml, and thus, its problems in multilingual courses like O1 started to show up.