Skip to content

Commit

Permalink
feat: add reportValidityAfterScoring option to processResponse method
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcelh1983 committed Jan 30, 2025
1 parent 88a945d commit 06c3576
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/lib/exports/config.context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { createContext } from '@lit/context';

export interface ConfigContext {
infoItemCategory?: string;
reportValidityAfterScoring?: boolean;
}

export const configContext = createContext<Readonly<ConfigContext>>(Symbol('configContext'));
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ export class QtiAssessmentItem extends LitElement {
}
}

public processResponse(countNumAttempts: boolean = true): boolean {
this.validate();
public processResponse(countNumAttempts = true, reportValidityAfterScoring = true): boolean {
this.validate(reportValidityAfterScoring);
const responseProcessor = this.querySelector<QtiResponseProcessing>('qti-response-processing');
if (!responseProcessor) {
// console.info('Client side response processing template not available');
Expand Down
3 changes: 2 additions & 1 deletion src/lib/qti-test/components/test-navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ export class TestNavigation extends LitElement {
`qti-assessment-item-ref[identifier="${this._sessionContext.navItemId}"]`
);
const qtiAssessmentItemEl = qtiItemEl.assessmentItem;
qtiAssessmentItemEl.processResponse();
const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;
qtiAssessmentItemEl.processResponse(true, reportValidityAfterScoring);
}

private _handleTestShowCorrectResponse(event: CustomEvent) {
Expand Down

0 comments on commit 06c3576

Please sign in to comment.