Skip to content

Commit

Permalink
Fix: Clarify the behavior when _assessmentId is left blank (fixes #7)
Browse files Browse the repository at this point in the history
  • Loading branch information
swashbuck committed May 21, 2024
1 parent 457d950 commit 0108641
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 15 deletions.
36 changes: 23 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,66 @@
# adapt-assessmentResultsGraphic

**Assessment Results Graphic** is a *presentation component* similar in behaviour to the Graphic component. However, a different graphic can be displayed based on the following state of the associated assessment:

* incomplete
* failed
* passed

The `_assessmentIncomplete` image is only needed if the Assessment Results Graphic can been seen by the learner prior to assessment completion (i.e. it hasn't been hidden either by the Trickle extension or by using `_isVisibleBeforeCompletion: false`). Otherwise, it can safely be left out.

It is expected that most of the time this component will have `_isOptional: true`. If it is _not_ optional, it does support the same `_setCompletionOn` settings as the Assessment Results component.
It is expected that most of the time this component will have `_isOptional: true`. If it is *not* optional, it does support the same `_setCompletionOn` settings as the Assessment Results component.

## Settings Overview

The attributes listed below are used in *components.json* to configure **Assessment Results Graphic**, and are properly formatted as JSON in [*example.json*](https://github.com/cgkineo/adapt-assessmentResultsGraphic/blob/master/example.json).

## Attributes

[**core model attributes**](https://github.com/adaptlearning/adapt_framework/wiki/Core-model-attributes): These are inherited by every Adapt component. [Read more](https://github.com/adaptlearning/adapt_framework/wiki/Core-model-attributes).
The [**core model attributes**](https://github.com/adaptlearning/adapt_framework/wiki/Core-model-attributes) are inherited by every Adapt component. [Read more](https://github.com/adaptlearning/adapt_framework/wiki/Core-model-attributes)

### \_component (string)

### \_component (string):
This must be set to: `"assessmentResultsGraphic"`.

### \_classes (string):
### \_classes (string)

CSS class name(s) to be applied to this component's containing `div`. The class must be predefined in one of the Less files. Separate multiple classes with a space.

### \_layout (string):
### \_layout (string)

This defines the horizontal position of the component in the block. Acceptable values are `full`, `left` or `right`.

### \_assessmentId (string):
This is the unique name of the assessment for which the graphic should be displayed.
### \_assessmentId (string)

This value must match the [`_id` of the assessment](https://github.com/adaptlearning/adapt-contrib-assessment#attributes) for which the graphic should be displayed. If you only have *one* assessment, you can leave this blank (the article's `_assessment._id` must also be blank).

### \_graphics (object)

### \_graphics (object):
The object that defines the images to use for each assessment state. It contains the following settings that apply to the `_assessmentIncomplete`, `_assessmentPassed`, and `_assessmentFailed` objects.

#### \_src (string):
File name (including path) of the image. Path should be relative to the `src` folder (e.g. `"course/en/images/origami-menu-two.jpg"`).
#### \_src (string)

File name (including path) of the image. Path should be relative to the `src` folder (e.g. `"course/en/images/assessment-pass.jpg"`).

#### alt (string)

#### alt (string):
The alternative text for this image. Assign [alt text](https://github.com/adaptlearning/adapt_framework/wiki/Providing-good-alt-text) to images that convey course content only.

## Accessibility

The graphic displayed uses an [aria-label](https://github.com/adaptlearning/adapt_framework/wiki/Aria-Labels) attribute. This uses the content from each graphic's `alt` property. If `alt` is not set, the graphic will be hidden.

## Notes

You *must* specify both the failed and passed images. If you don't want to have a different graphic for each of those assessment states, you should probably just be using the standard [Graphic component](https://github.com/adaptlearning/adapt-contrib-graphic).

## Limitations

No known limitations.

----------------------------
**Framework versions:** 5+<br>
**Author / maintainer:** Kineo<br>

**Author / maintainer:** CGKineo<br>
**Accessibility support:** Yes<br>
**RTL support:** Yes<br>
**Cross-platform coverage:** Chrome, Chrome for Android, Firefox (ESR + latest version), Edge, Safari for macOS/iOS/iPadOS, Opera<br>
2 changes: 1 addition & 1 deletion properties.schema
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"required": true,
"title": "Assessment Name",
"default": "",
"help": "The unique name of the assessment for which the graphic should be displayed.",
"help": "The unique name of the assessment for which the graphic should be displayed. If you only have one assessment, you can leave this blank (the article's assessment ID must also be blank)",
"inputType": "Text",
"validators": []
},
Expand Down
2 changes: 1 addition & 1 deletion schema/component.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"type": "string",
"title": "Assessment Name",
"default": "",
"description": "The unique name of the assessment for which the graphic should be displayed."
"description": "The unique name of the assessment for which the graphic should be displayed. If you only have one assessment, you can leave this blank (the article's assessment ID must also be blank)"
},
"_isVisibleBeforeCompletion": {
"type": "boolean",
Expand Down

0 comments on commit 0108641

Please sign in to comment.