0.0.4 • Published 10 months ago

quizzlistmodule v0.0.4

Weekly downloads
-
License
-
Repository
-
Last release
10 months ago

Working of auth module in the app :

The whole auth of the app is currently handled by the Firebase reducer (src/appRedux/reducers/Firebase.js)

The Firebase reducer has many fields, the most important for auth is userSignature.

The default value for the userSignature is fetched from the sessionStorage.

If the route of the map is / or /mybank , the value of firebase and the userSignature is checked, if any one of them is missing , a message is shown that the user is not authenticated (/src/containers/App/index.js (line 115))

If both Firebase and userSignature are present, and the value of initURL is either "","/","/signin","/mybank" , two conditions exist

If the isAuthenticated value is true in Firebase reducer and the user is an instructor , then if lastRoute exist, the user is redirected to lastRoute

If any of the above two is false, then the user is redirected to /mybank

If the initUrl are not one of "","/","/signin","/mybank" then the person is redirected to the route with the value of unitURL

Whenever a restrictedRoute is accessed, the MainApp component is rendered (/src/containers/App/MainApp)

The constructor of the MainApp then initializes the Firebase reducer with AuthToken firestore auth, with the call of initFirebase function (line 67)

In case initFirebase fails FETCH_FB_AUTH_TOKEN_FAILURE actions gets called

========================================================================================

STEPS FOR ADDING AN ITEMTYPE IN THE POLLING UX :

Suppose we are adding "matching" itemtype

Add a new item name in ItemConstants.js (src/constants/itemConstants.js) and export it. export const ITEM_SUBTYPE_MATCHING = 'matching'

The first thing to add is the item type in the header area from where we select an item type by clicking the + button. We do this by adding the type by providing the title and key in the options array in AddItemsToolBar component ('src/containers/Main/Quiz/add_items_tool_bar.js) const options= {"title":"Short Answer", "key":"fib"}, {"title":"Multiple Choice", "key":"mcq"}, {"title":"Multiple Select", "key":"msq"}, {"title":"Matching", "key":"matching"}

onToolBarClick method is called in called in ('src/containers/Main/Quiz/edit.js) and addQuizItemActionCreator is called with actionInfo actionInfo in our case will be , actionInfo = { quizId: quizId, itemType : 'assessment', itemSubtype : 'matching', itemIndex: 99999 }

In card.js ('src/containers/Main/Item/card.js) we add one subType inside the switch in renderItem method so that it recognizes which specific Card is to be rendered.

We add a new file with the name of the item type , and build that component. We place that file in the folder ('src/containers/Main/Item), so the path of the resulting item component will be (src/containers/Main/Item/matching.js)

Build that component with the required redux methods and API calls for the new item sub type and import that in card.js .

=======================================================================================

JSON for Matching :

{

"_id", "type" : "assessment", "subtype" : "matching", "content" : { "id" : "8a9e1c6f-b89c-42a2-a45a-47f2943907d6", "stimulus" : "Match the following items according to something ", "distractors"(Incorrect options which will have no match) : { "value", "pointPercentage" : 0, "id", attachmentId }, "pairs" : { "id", "pointPercentage" : 1, "lValue": {id,value,mimeType,attachmentId}, "rValue": {id,value,mimeType,attachmentId} } }, "uuid", "relations" : { "topics", }, "owner_uuid" : "13ce599d-0ff0-48b9-a948-a4aace5abdc1", "draftTopic" : true, "created_timestamp", "last_modified_timestamp", "status" : "draft", "max_attempts" : 1, "version" : 1, "parent_version" : 0, "title" : "matching", "measure" : { "difficulty", "blooms_level", "max_lrnr_points" }, "deleted" : false, "isValid" : false, "assessmentReady" : { "reason" : "Item is changed", "flag" : false } "attachments" : { "id", "url", "name" : "blob", "size", "type" , "imageContent" : "", "attachmentInfo" : { "entity" : "option"/"stimulus", "type" , "attachedId" } }

====================================================================================================

Session storage keys needed for making the auth work :

  • sectionCodes
  • oerServerURL
  • pollingServerURL
  • livePortUrl
  • fbConfig
  • beamPortUrl
  • userSignature
  • contentServerURL
  • pollingURL

==================================================================================================== Item Json structure required for matching on assessment side :

_id, assessment_config, attachments, content : { id, stimulus, lItems : { id, value, } , rItems : { id, value } }, subtype, title, type, uuid, owner_uuid

================================================================================== Json of Authoring for Sorting :

{

"_id", "type" : "assessment", "subtype" : "sorting", "content" : { "id" : "8a9e1c6f-b89c-42a2-a45a-47f2943907d6", "stimulus" : "Match the following items according to something ", "sortedElements" : { "id", "pointPercentage" : 1, "value":"Any Value", “attachmentId”:””, “mimeType”:”” “weights”:”” } }, "uuid", "relations" : { "topics", }, "owner_uuid" : "13ce599d-0ff0-48b9-a948-a4aace5abdc1", "draftTopic" : true, "created_timestamp", "last_modified_timestamp", "status" : "draft", "max_attempts" : 1, "version" : 1, "parent_version" : 0, "title" : "matching", "measure" : { "difficulty", "blooms_level", "max_lrnr_points" }, "deleted" : false, "isValid" : false, "assessmentReady" : { "reason" : "Item is changed", "flag" : false } "attachments" : { "id", "url", "name" : "blob", "size", "type" , "imageContent" : "", "attachmentInfo" : { "entity" : "option"/"stimulus", "type" , "attachedId" } }