Skip to content

Commit

Permalink
Add min-group-size and max-group-size options to exercises
Browse files Browse the repository at this point in the history
Define min-group-size and max-group-size options in
the exercise directives `submit` and `questionnaire`.

Fixes #70
  • Loading branch information
EerikSaksi authored and markkuriekkinen committed Dec 14, 2022
1 parent ff7bd5e commit 7bd4a95
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions directives/abstract_exercise.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ class ConfigurableExercise(AbstractExercise):
'category': directives.unchanged,
'no-configure': directives.flag,
'no-override': directives.flag,
'min-group-size': directives.nonnegative_int,
'max-group-size': directives.nonnegative_int,
}

def apply_override(self, data, category=None):
Expand Down
4 changes: 2 additions & 2 deletions directives/questionnaire.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ def run(self):
'category': category,
'difficulty': difficulty or '',
'max_submissions': self.options.get('submissions', 0 if is_feedback else env.config.questionnaire_default_submissions),
'min_group_size': 1 if is_feedback else env.config.default_min_group_size,
'max_group_size': 1 if is_feedback else env.config.default_max_group_size,
'min_group_size': self.options.get('min-group-size', 1 if is_feedback else env.config.default_min_group_size),
'max_group_size': self.options.get('max-group-size', 1 if is_feedback else env.config.default_max_group_size),
'points_to_pass': self.options.get('points-to-pass', 0),
'feedback': is_feedback,
'view_type': 'access.types.stdsync.createForm',
Expand Down
4 changes: 2 additions & 2 deletions directives/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ def run(self):
'scale_points': points,
'difficulty': difficulty or '',
'max_submissions': self.options.get('submissions', data.get('max_submissions', env.config.program_default_submissions)),
'min_group_size': data.get('min_group_size', env.config.default_min_group_size),
'max_group_size': data.get('max_group_size', env.config.default_max_group_size),
'min_group_size': self.options.get('min-group-size', data.get('min_group_size', env.config.default_min_group_size)),
'max_group_size': self.options.get('max-group-size', data.get('max_group_size', env.config.default_max_group_size)),
'points_to_pass': self.options.get('points-to-pass', data.get('points_to_pass', 0)),
# The RST source file path is needed for fixing relative URLs
# in the exercise description.
Expand Down

0 comments on commit 7bd4a95

Please sign in to comment.