Every time a learning design (or sequence) is saved in authoring, the LAMS server validates the learning design.
If an error is found, then the design is still saved, but the design is marked as invalid in the database ("isValid" column) and the isValid value will be passed back to the client. If it is invalid then the "saved" message will indicate that the design is incomplete and it will have a button to expose a list of why the design it incomplete/invalid
An invalid design cannot be previewed. When a user tries to start a lesson, only valid designs are displayed.
This allows the user to save an incomplete learning design (e.g. haven't put all the transitions in yet), yet be confident that any design they run will be able to run to completion.
When a learning design is modified in Live Edit, the user will not be able to save an invalid learning design. The authoring client won't try to save to the server. Live Edit only allows the user to do one save, so we can't allow an invalid learning design to be saved in Live Edit.
In LAMS 2.0, the validation is done by the LearningDesignService but in 2.1 it has been moved to the LearningDesignValidator class. This contains most of the rules for validation, but some activity specific rules (e.g. a branching activity must have at least one branch and it has to have a default branch) is implemented in the activity itself.
Validation Messages
The server will return any validation "messages" in the response packet. The "messages" will be a list of ValidationErrorDTO objects, containing internationalised messages:
Rules and ValidationErrorDTO Messages
The Rules and the values for the ValidationErrorDTO will be as follows. More messages will be added as more rules are determined.
Rule: Other (Used to cover any cases that are not covered by another code)
UUID: n/a
Message: Error text (in English) describing problem will be put into the message field
Rule: Each transition must have an activity before and after the transition
UUID: Transition that is missing a leading/trailing activity
Message: A Transition must have an activity before or after the transition
Rule: For any learning design that has more than one activity then each activity should have at least one input or one output transition.
UUID: The activity that is missing the transition
Message: An activity must have an input or output transition
Rule: Exactly one "top level" activity will have no input transition
Only check the activities directly in the design, do not check activities inside complex activities.
If more than one activity is missing the input transition, one ValidationErrorDTO will be created for each activity that has no input transition. One of these activities will legitimately not have an input transition but we can't tell which one!
UUID: Activity which is missing the input transition.
Message: There is more than one activity with no input transition
If no activities are missing their input transitions (i.e. all activities have an input transition) then return a different code. Cannot determine which activity is at fault therefore no activity UI ID will be returned.
UUID: n/a
Message: No activities are missing their input transition.
Rule: Exactly one "top level" activity will have no output transition
Only check the activities directly in the design, do not check activities inside complex activities.
If more than one activity is missing the output transition, one ValidationErrorDTO will be created for each activity that has no output transition. One of these activities will legitimately not have an output transition but we can't tell which one!
UUID: Activity which is missing the output transition.
Message: There is more than one activity with no output transition
If no activities are missing their output transitions (i.e. all activities have an output transition) then return a different code. Cannot determine which activity is at fault therefore no activity UI ID will be returned.
UUID: n/a
Message: No activities are missing their output transition.
The above three rules will ensure that the design is not circular.
Rule: If grouping is required (i.e. activity has GROUPING _SUPPORT_REQUIRED) then a grouping must have been applied to the activity.
UUID: Activity that has not been assigned a grouping.
Message: Grouping is required
Rule: If grouping is not supported required (i.e. activity has GROUPING_SUPPORT_NONE) then a grouping has not been applied to the activity.
UUID: Activity that has been erroneously assigned a grouping.
Message: Grouping is not supported
Rule: If a grouping is selected, then the grouping exists (this will be a server only check).
UUID: Activity that has a missing grouping.
Message: Grouping is selected but does not exist
Rule: An optional activity must contain one or more activities
UUID: Optional Activity that has no activities.
Message: An Optional Activity must have one or more activities
Rule: An optional activity must have valid order ids - the order ids should be sequential starting at 1 and must have no duplicates.
UUID: The Optional Activity with invalid order ids.
Message: This Optional Activity has invalid order id.
Rule: All branching activities should have at least one branch and the default activity must be set for a tool based branch. (Added LAMS 2.1)
UUID: The Branching Activity
Message:
- A Branching Activity must have at least one branch.
- A Tool Output Based Branching Activity must have as a default branch.
Rule: If a sequence activity is part of an optional activity then there must be at least one child activity and the default activity must be set as this is the first activity in the sequence. If a sequence activity is part of a branching activity then there there may be no child activities but if there are child activities then the default activity set. (Added LAMS 2.1)
UIID: The Sequence Activity with no children / default activity not set.
Message: A branch must have a first activity.
Rule: For Group Based Branching, a Grouping must be applied to the branching activity. If Define Later == false, then there must be at least one group in the grouping
UIID: The Group Based Branching activity. (Added LAMS 2.1)
Message: A group based branching activity must have a grouping activity.
Rule: For Group Based Branching with Define Later == false then all groups must have a branch allocated to them.
UIID: The Group Based Branching activity. (Added LAMS 2.1)
Message: A group based branching activity must have all groups assigned to a branch.
Rule: A Tool output based branching activity must have an input activity. (Added LAMS 2.1)
UUID: The Branching Activity
Message: A Tool Output Based Branching Activity must have an Input Tool.
Rule: All conditions must have either (a) an exact match value or (b) a start value and no end value or (c) start value and an end value and the end value must be >= start value. (Added LAMS 2.1)
UUID: The Branching Activity that has the Tool Output Condition with a bad start/end/exact match values.
Message: The condition is missing the comparison value.