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

Multiple templates for a templated question/exam #49

Closed
jhoobergs opened this issue Aug 15, 2021 · 6 comments
Closed

Multiple templates for a templated question/exam #49

jhoobergs opened this issue Aug 15, 2021 · 6 comments
Projects

Comments

@jhoobergs
Copy link
Collaborator

Instead of just a template field with a file_name (e.g. template: question_template) it would become a map.

template:
  default:
    path: question_template
    suffix: normal # Used as suffix after compilation, optional for the default
  other:
    - path: other_question_template
      name: other # rumbas compile --template other .. will be needed
      suffix: other
   -  path: verbose_question_template
      name: verbose # rumbas compile --template verbose .. will be needed
      suffix: v    

It will remain possible to just give a string which would equal

template:
  default:
    path: <string_value>
@wiobber
Copy link
Collaborator

wiobber commented Aug 15, 2021

Unless there are issues for the actual yaml/rust implementation, a simpler map could be

template:
  path: this_question_template
  variants:    # or perhaps better 'versions' / 'alternatives' /  'types' ... ?
    - variant: verbose # rumbas compile --template-variant verbose .. will be needed
      path: this_question_template_verbose
    - variant: overview
      path: this_question_template_overview
    - variant: other # rumbas compile --template-variant other .. will be needed
      path: this_question_template_other

It will remain possible to just give a string which would equal

template: <string_value>

rumbas would have an exam-level --template-variant option, that would imply using templates of a given variant if present. If a question does not have a template at all, or does not have a given variant-template, the normal, default output is generated for that question.
The template-variant could perhaps also influence the theme, or also a --theme/--defaults option can be given to rumbas to specify the theme to be used (e.g. an 'overview' theme with several questions per page, with limited whitespace and buttons, but with (file-)names of questions, a 'verbose' theme that also shows description/author and perhaps even variables and/or sourcecode).

The suffix is not really needed per question, but rather per exam or per rumbas-run. Following exam-yaml could eg generate two exams:

template-variants:
   - variant: default
     suffix: ''
   - variant: overview
     suffix: overview

rumbas compile --template-variant overview --theme overview --suffix _overview
rumbas compile --theme formative # with retry, show answer, etc (perhaps better--defaults formative, which would include the theme to be used ?)
rumbas compile --theme summative # with timing, password, etc (perhaps better --defaults summative ?)

See related issue #22

@jhoobergs
Copy link
Collaborator Author

jhoobergs commented Aug 15, 2021

  • It might be best to let the variants itself live in a special folder variants where they are specified in yaml file.
    • For now each of the variant yaml files will just contain one field: suffix
      • Other fields that override specific settings (like theme) might be add later
    • This is needed because each question needs to be compileable standalone, so the suffix is sometimes also needed for the question.
    • This way, variants can be reused across different exams.

An exam can specify multiple variants and by default all of these will be compiled on compile, just like all locales are compiled by default.

For the variants as well as the locale, a flag will be added to allow compiling just one locale or variant.

I will update the initial issue with this information later.

@wiobber
Copy link
Collaborator

wiobber commented Aug 16, 2021

or even just variant templates in the question_templates folder with a naming-convention:

derivative.yaml
derivative-short.yaml
derivative-verbose.yaml
indefintegral.yaml
indefintegral-short.yaml

the suffix is the trailing part -short / -verbose / ....
the question just contains 'template: derivative' or 'template: indefintegral' (and perhaps should not contain (double) dashes, and the suffix should rather be --short, --verbose ...?)

@jhoobergs
Copy link
Collaborator Author

jhoobergs commented Aug 16, 2021

Variants

It needs to work closer with the default values.

New folder structure

- A `variants` folder
	- This contains a folder for each variant with following files
		- A `variant.yaml` file specifies
			- which variant this variant extends (possibly none)
			- which suffix should be used
		- Default files like the once that currently exist in the `defaults` folder
			- These override certain values of the variant that it extends
- The `defaults` folder is moved to `variants/default`

Templating with variants

New template field in a question

template:
  default: question_template
  other: other_question_template
  verbose: verbose_question_template

It would still be possible to just write

template: question_template

to mean

template:
  default: question_template

New variants field in an exam

variants: [default, other, verbose]

Compilation

Commands

rumbas compile exam/exam_file.yaml will compile all variants specified in the exam file.
rumbas compile --variant other exam/exam_file.yaml will only compile the variant named other.
rumbas compile --variant not_specified exam/exam_file.yaml will only compile the variant named not_specified which does not need to be specified in the variants field of the exam.
rumbas compile question/question_file.yaml will compile the question with

  • the default variant for normal questions;
  • all specified variants for a templated question.

rumbas compile --variant other question/question_file.yaml will compile the question with variant named other.

What does the compilation do?

  • The default values for the specific variant are used
  • For templated questions:
    • If a template is specified for the specific variant, that one is used
    • Else, the default one is used

Changing a theme

  • Changing the theme can be done be creating a specific variant that extends an existing one and only overrides the theme.

PS

Something else / related

To make life easier (and reduce duplicate yaml), a question_template should be able to use a template itself and this template needs to be templateable itself. This would make certain things easier, like setting certain fields (like advice) to an empty string.

short_question_template.yaml
---
template: template:template # this is templateable
statement: template:statement
variables: template:variables
advice: ""
general_question_template.yaml
---
statement: template:statement
variables: template:variables
advice: template:advice
...
short_general_question_template.yaml
---
template: general_question_template
statement: template:statement
variables: template:variables
advice: ""
...

@jhoobergs jhoobergs mentioned this issue Dec 3, 2021
6 tasks
@jhoobergs jhoobergs added this to To do in Version 1 via automation Dec 3, 2021
@jhoobergs jhoobergs moved this from To do to Next in Version 1 Dec 3, 2021
@jhoobergs
Copy link
Collaborator Author

This can now be handled by using symlinks.
Example folder structure:

  • exams/Formative/exams: contains all exams but doesn't specify the value for review and navigation etc
  • exams/Formative/defaults/*: set the values to be used for a formative exam
  • exams/Summative/exams -> exams/Formative/exams (symlink)
  • exams/Summative/defaults/*: set the value to be used for a summative exam

@jhoobergs
Copy link
Collaborator Author

Templates are now also templateable so the PS in #49 (comment) is also usable now.

Version 1 automation moved this from Next to Done Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants