Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/Citolab/qti-components into…
Browse files Browse the repository at this point in the history
… main
  • Loading branch information
patrick committed Nov 14, 2023
2 parents 5e7ad45 + d68294b commit acfcbec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,10 @@ export class QtiInlineChoiceInteraction extends Interaction {
`;
}

firstUpdated(val) {
super.firstUpdated(val);
connectedCallback() {
super.connectedCallback();
this.addEventListener('on-dropdown-selected', this.choiceSelected);
const choices = Array.from(this.querySelectorAll('qti-inline-choice'));

this.options = [
{
textContent: this.dataPrompt,
Expand All @@ -72,6 +71,10 @@ export class QtiInlineChoiceInteraction extends Interaction {
];
}

disconnectedCallback() {
this.removeEventListener('on-dropdown-selected', this.choiceSelected);
}

public validate(): boolean {
const selectedOption = this.options.find(option => option.selected);
return selectedOption ? selectedOption.value !== '' : false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class QtiLookupOutcomeValue extends QtiRule {
if (outcomeVariable.interpolationTable) {
value = outcomeVariable.interpolationTable.get(parseInt(this.childExpression.calculate()));
}
if (!value) {
if (value === null || value === undefined) {
console.warn('lookupOutcomeValue: value is null or undefined');
return 0;
}
Expand Down

0 comments on commit acfcbec

Please sign in to comment.