gradelib.policies.attempts
- Allow multiple attempts
- gradelib.policies.attempts.take_best(gradebook: Gradebook, attempts: Mapping[str, Sequence[str]], *, remove=True, policy: Callable[[int, float], float] | None = None, points_possible: int | float = 1.0)
Replaces multiple attempts at an assignment with the best.
- Parameters:
gradebook (Gradebook) – The gradebook that will be modified.
attempts (Mapping[str, Sequence[str]]) – A mapping from the name of the new assignment to a sequence of existing assignments that will be used to determine the score on the new assignment.
remove (bool, optional) – Whether to remove the existing assignments, by default True.
policy (Optional[Callable[[int, float], float]]) – A function that takes an attempt number (with 0 being the first attempt) and a score and returns a new score. This can be used to penalize later attempts, for example. By default, the identity function is used.
points_possible (Union[int, float], optional) – The number of points possible on the new assignment, by default 1.