Exercises, Interactions and Resources

AlgebraKiT's Web Components are the frontend components that enable students to make exercises. There are three categories of web components:

  1. An Exercise web component represents a complete exercise, which can contain multiple questions (a, b, c) and interactions. All exercise web components are defined through the tag akit-exercise.
  2. An Interaction web component represents a single interactive element in an exercise. An overview of interaction types can be found here. All interaction web components are defined through the tag akit-interaction. AlgebraKiT will automatically figure out which question type is intended, such as algebra, geometry, long arithmetic, etc.
  3. Resource web components display mathematical content such as formulae, tables and graphs. All presentation web components are defined through the tag akit-resource.

Mix AlgebraKiT interactions with other question types

An akit-exercise web component can represent complex exercises, with multiple content blocks and interactions. You can also use AlgebraKiT's math interactions directly in your own exercises using the akit-interaction web component. This allows you to stay in control of authoring, storing and running your own exercises and use AlgebraKiT to extend your set of question types.

General options for exercises

<akit-exercise session-id="..."></akit-exercise>

Attribute Description
session-id A session represents a single user solving a single exercise. You obtain the session id by calling AlgebraKiT’s web service from your backend, see create-session
start-active If this attribute is set, the exercise is immediately activated after it is created. This means that the session is started and a palette with buttons is visible. Only one exercise can be active at any time, so the attribute is neglected on any following web components in the same page. Default value is 'false'
show-hints When set to 'false' the hint button is hidden. Default value is 'true'
review-mode When set to 'true' the web components will show all student inputs and responses from AlgebraKiT. This feature is intended for reviewing the student's actions by a teacher.
solution-mode When set to 'true' the web components will show the solution of the interaction. For Multistep Math interactions a worked-out derivation will be shown.

Methods for exercises

You can call the following methods on the akit-exercise nodes. All methods return a Promise

Method Description
submit submit(): Promise<ScoringData>
Evaluate all interactions in the exercise and return scoring information.
isFinished isFinished(): Promise<boolean>
Returns true if all interactions in the exercise are finished or given up.
setActive setActive(): Promise<>
Make the first non-finished interaction in the exercise active.
finishPendingEvents finishPendingEvents(): Promise<>
Wait until all learning activities (evaluation, hint, etc) are fully processed. Use this e.g. before retrieving scoring information from AlgebraKiT's web service.

Events

You can listen to all events in a session by registering through addExerciseListener(). An eventData object is passed with each event. The eventData.event property denotes the type of event and what eventData.data to expect with this event. These types are listed below including their specific data.


exercise-created

Submitted when the exercise with its initial interactions is created and ready in the web page.

Data

Property Type Description
element Element The DOM element of the exercise web component.

interaction-created

Submitted when an interaction web component is created and ready in the web page.

Data

Property Type Description
element Element The DOM element of the exercise web component.

interaction-activated

Submitted when an interaction web component is activated for the first time (e.g. the student clicked on the web component).


interaction-hint

The student requested a hint.


interaction-evaluate

The student submitted an (intermediate) step, which was evaluated by AlgebraKIT.

Data

Property Type Description
exerciseFinished boolean Indicates whether the interaction is now finished or not.
interactionType string The web component type (e.g. 'multistep', 'choice', etc
progress number Value in the range [0,1] indicating how far the student is with solving the exercise. Applies to exercises that contain multiple sub problems in the authored correction model.
replay boolean When true, the web component submitted this event while replaying all the events to reconstruct an already existing session. This applies when the student revisits an interaction or when the web component is created in review mode.
scoring Object Contains scoring information, if a scoring model is set in Create Session. See Scoring for more information.

interaction-finished

The student finished the interaction

Data Same as for interaction-evaluate


question-finished

All interactions in a question of the exercise are finished.

Data

Property Type Description
scoring Object Contains scoring information for all interactions in this question combined, if a scoring model is set in Create Session](../webservice/#create-session). See Scoring for more information.
replay boolean When true, the web component submitted this event while replaying all the events to reconstruct an already existing session. This applies when the student revisits an interaction or when the web component is created in review mode.

exercise-finished

All interactions in the exercise are finished.

Data

Property Type Description
scoring Object Contains scoring information for this exercise, if a scoring model is set in Create Session](/webservice/create-session). See Scoring for more information.
replay boolean When true, the web component submitted this event while replaying all the events to reconstruct an already existing session. This applies when the student revisits an interaction or when the web component is created in review mode.