Skip to content

Update: Add JSDoc to question and items model layer (fixes #853)#863

Open
joe-replin wants to merge 1 commit into
masterfrom
issue/853
Open

Update: Add JSDoc to question and items model layer (fixes #853)#863
joe-replin wants to merge 1 commit into
masterfrom
issue/853

Conversation

@joe-replin
Copy link
Copy Markdown
Contributor

Fixes #853

Update

  • questionModel.js — added @file/@module header, @class block, and JSDoc for all public methods (canSubmit, isCorrect, isPartlyCorrect, getFeedback, isInteractive, reset, resetQuestion, refresh, getButtonState, getInteractionObject, getResponse, getResponseType, onSubmitted, addContextActivity, addContentObjectContextActivities, contextActivities, score, maxScore, minScore, setScore); removed 13 redundant inline comments that restated method names
  • itemModel.js — added @file/@module header, @class block, and JSDoc for toggleClass, toggleActive, and toggleVisited; fixed pre-existing @param name {type} tag order to standard @param {type} name
  • itemsComponentModel.js — added @file/@module header, @class block, and JSDoc for restoreUserAnswers, storeUserAnswer, getItem, and setActiveItem
  • itemsQuestionModel.js — added @file/@module header, @class block, and JSDoc for restoreUserAnswers, setupRandomisation, storeUserAnswer, isCorrect, getFeedback, score, maxScore, minScore, getInteractionObject, getResponse, getResponseType, getCorrectAnswerAsText, and getUserAnswerAsText; fixed two malformed /**\n * JSDoc blocks

Testing

  1. Run grunt build and verify no JS errors
  2. Open a course with an MCQ component; confirm question submits, marks, and resets correctly

Add comprehensive JSDoc headers and inline documentation across itemModel, itemsComponentModel, itemsQuestionModel, and questionModel. Document class responsibilities, public methods and return values (e.g. toggleClass, toggleActive/toggleVisited, restoreUserAnswers, storeUserAnswer, getItem, setActiveItem, setupRandomisation, getInteractionObject, getResponse/getResponseType), and note a few known issues/improvements. Enhance QuestionModel with clearer abstract method docs (canSubmit, isCorrect, isPartlyCorrect, getFeedback, getResponse, getResponseType), button state helper and small API clarifications. No functional behavioral changes beyond added return annotations and documentation, and a few minor API clarifications (toggleClass now documents chaining return).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Needs Reviewing

Development

Successfully merging this pull request may close these issues.

JSDocs - Component Models

1 participant