Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

schema amends: change boolean selects to checkboxes #86

Closed
wants to merge 6 commits into from

Conversation

moloko
Copy link
Contributor

@moloko moloko commented Apr 27, 2017

see adaptlearning/adapt_authoring#1380

please leave unmerged until all core plugins have been updated

Also set the _randomisation._blockCount to -1 by default, meaning all blocks are randomised if the setting is enabled.
The .slice() call was returning an array, when what we really want is the first assessment if no 'id' is specified.
- Returns the first item by default in _getStateByAssessmentId() if a blank 'id' is passed
- Adds a warning message if an assessment has been registerd with an empty 'id' or if the 'id' already exists
js/assessment.js Outdated
@@ -242,7 +242,7 @@ define([

get: function(id) {
if (id === undefined) {
return this._assessments.slice(0);
return this._assessments[0];
Copy link
Member

@oliverfoster oliverfoster Jun 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't a minor change:

get() == getAll()  !  getFirst();
get("id") == getById(id)

if you need getFirst may I suggest you add a new function?

getFirst: function() {
    return this._assessments[0];
},

getAll: function() {
    return this._assessments.slice(0);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch @oliverfoster. I didn't actually need a getFirst(). The change in 4ec4121 seems to do enough.

Copy link
Member

@oliverfoster oliverfoster Jun 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't think the approach you've taken solves the problem you've described.

issue: users aren't filling in the assessment id on the article and results component because it's not obvious or clear and it's breaking Adapt

solution: make assessment results and assessment work with no ids where appropriate

https://github.com/adaptlearning/adapt-contrib-assessmentResults/blob/master/js/adapt-contrib-assessmentResults.js#L225

var assessmentModel;
if (!state.id) {
assessmentModel = Adapt.assessment.get()[0];
} else {
assessmentModel = Adapt.assessment.get(state.id);
}

^ if no id defined in assessmentResults, pick the first one.

https://github.com/adaptlearning/adapt-contrib-assessment/blob/master/js/adapt-assessmentArticleModel.js#L108

var assessmentConfig = this.get("_assessment");
if (!assessmentConfig._id) {
    assessmentConfig._id = this.model.get("_id");
}

^ if no id defined in assessment, take article id

My misunderstanding of this function introduced a breaking change, which @oliverfoster caught.

A better solution is to standardise the handling of undefined or assessment 'id' values which are empty strings.  Warning messages are now output when appropriate, but the code allows an empty assessment 'id', e.g. if there is only one assessment on the course.
@moloko
Copy link
Contributor Author

moloko commented Jun 28, 2017

Sorry but I do have to say this has now got well beyond the bounds of what should be 'tacked on' to a a PR that is specifically to do with schema changes!

@brian-learningpool would you mind setting up an issue that documents the problem you are trying to solve and creating a new PR to go with it?

@brian-learningpool
Copy link
Member

Issue raised here:
adaptlearning/adapt_framework#1621

@brian-learningpool
Copy link
Member

@guywillis guywillis deleted the issue/#1380 branch January 24, 2020 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants