{"version":3,"file":"diagnostic-BWq0D-hY.js","sources":["../../../client/app/bundles/Shared/components/shared/resumeOrBeginButton.tsx","../../../client/app/bundles/Shared/components/shared/smartSpinner.tsx","../../../client/app/bundles/Shared/quill-marking-logic/src/libs/algorithms/partsOfSpeech.ts","../../../client/app/bundles/Shared/quill-marking-logic/src/libs/matchers/parts_of_speech_match.ts","../../../client/app/bundles/Shared/quill-marking-logic/src/libs/graders/diagnostic_sentence_fragment.ts","../../../client/app/bundles/Diagnostic/actions/concepts.js","../../../client/app/bundles/Diagnostic/actions/fillInBlank.ts","../../../client/app/bundles/Diagnostic/libs/lessons_api.ts","../../../client/app/bundles/Diagnostic/actions/sentenceFragments.ts","../../../client/app/bundles/Diagnostic/actions/titleCards.ts","../../../client/app/bundles/Diagnostic/actions/lessons.ts","../../../client/app/bundles/Diagnostic/components/navbar/studentNavbar.tsx","../../../client/app/bundles/Diagnostic/components/navbar/teacherNavbar.tsx","../../../client/app/bundles/Diagnostic/components/questions/questionForm.jsx","../../../client/app/bundles/Diagnostic/components/concepts/concept.jsx","../../../client/app/bundles/Diagnostic/components/shared/linkListItem.tsx","../../../client/app/bundles/Diagnostic/components/concepts/concepts.jsx","../../../client/app/bundles/Diagnostic/actions/massEdit.js","../../../client/app/bundles/Diagnostic/components/questions/conceptResultList.jsx","../../../client/app/bundles/Diagnostic/actions/display.js","../../../client/app/bundles/Diagnostic/components/questions/massEditContainer.jsx","../../../client/app/bundles/Diagnostic/actions/filters.js","../../../client/app/bundles/Diagnostic/libs/grading/rematching.ts","../../../client/app/bundles/Diagnostic/libs/partsOfSpeechTagging.js","../../../client/app/bundles/Diagnostic/libs/algorithms/changeObjects.js","../../../client/app/bundles/Diagnostic/libs/algorithms/joiningWords.js","../../../client/app/bundles/Diagnostic/libs/algorithms/spacingBeforePunctuation.js","../../../client/app/bundles/Diagnostic/libs/quillNormalizer.js","../../../client/app/bundles/Diagnostic/libs/requiredWords.js","../../../client/app/bundles/Diagnostic/libs/sharedResponseFunctions.js","../../../client/app/bundles/Diagnostic/libs/question.js","../../../client/app/bundles/Diagnostic/libs/validEndingPunctuation.js","../../../client/app/bundles/Diagnostic/libs/sentenceFragment.js","../../../client/app/bundles/Diagnostic/components/questions/POSForResponse.jsx","../../../client/app/bundles/Diagnostic/components/questions/POSIndex.jsx","../../../client/app/bundles/Diagnostic/components/questions/POSForResponsesList.jsx","../../../client/app/bundles/Diagnostic/components/questions/response.tsx","../../../client/app/bundles/Diagnostic/components/questions/responseList.tsx","../../../client/app/bundles/Diagnostic/components/questions/responseComponent.jsx","../../../client/app/bundles/Diagnostic/components/questions/responseRouteWrapper.jsx","../../../client/app/bundles/Diagnostic/components/renderForQuestions/cues.tsx","../../../client/app/bundles/Diagnostic/components/fillInBlank/fillInBlankForm.jsx","../../../client/app/bundles/Diagnostic/components/fillInBlank/editFillInBlank.jsx","../../../client/app/bundles/Diagnostic/components/renderForQuestions/submitResponse.js","../../../client/app/bundles/Diagnostic/components/renderForQuestions/updateResponseResource.js","../../../client/app/bundles/Diagnostic/components/fillInBlank/playFillInTheBlankQuestion.tsx","../../../client/app/bundles/Diagnostic/components/fillInBlank/testFillInBlankQuestionContainer.jsx","../../../client/app/bundles/Diagnostic/components/fillInBlank/fillInBlankQuestion.jsx","../../../client/app/bundles/Diagnostic/components/shared/questionList.tsx","../../../client/app/bundles/Diagnostic/components/fillInBlank/fillInBlankQuestions.jsx","../../../client/app/bundles/Diagnostic/components/fillInBlank/newFillInBlank.jsx","../../../client/app/bundles/Diagnostic/components/lessons/chooseModel.tsx","../../../client/app/bundles/Diagnostic/components/lessons/lessonFormComponents.tsx","../../../client/app/bundles/Diagnostic/components/lessons/lessonForm.tsx","../../../client/app/bundles/Diagnostic/components/lessons/lesson.jsx","../../../client/app/bundles/Diagnostic/components/lessons/lessons.jsx","../../../client/app/bundles/Diagnostic/components/misc/diffedResponse.jsx","../../../client/app/bundles/Diagnostic/components/misc/answerVisualizer.jsx","../../../client/app/bundles/Diagnostic/components/focusPoints/editFocusPointsContainer.jsx","../../../client/app/bundles/Diagnostic/components/focusPoints/focusPointsContainer.jsx","../../../client/app/bundles/Diagnostic/components/focusPoints/newFocusPointsContainer.jsx","../../../client/app/bundles/Diagnostic/components/incorrectSequence/editIncorrectSequenceContainer.jsx","../../../client/app/bundles/Diagnostic/components/incorrectSequence/incorrectSequenceContainer.jsx","../../../client/app/bundles/Diagnostic/components/incorrectSequence/newIncorrectSequenceContainer.jsx","../../../client/app/bundles/Diagnostic/components/questions/boilerplateFeedback.jsx","../../../client/app/bundles/Diagnostic/components/questions/chooseModelContainer.jsx","../../../client/app/bundles/Diagnostic/actions.js","../../../client/app/bundles/Diagnostic/components/renderForQuestions/checkAnswer.ts","../../../client/app/bundles/Diagnostic/components/renderForQuestions/feedbackStatements.jsx","../../../client/app/bundles/Diagnostic/libs/markupUserResponses.js","../../../client/app/bundles/Diagnostic/components/renderForQuestions/renderTextEditor.jsx","../../../client/app/bundles/Diagnostic/components/diagnostics/sentenceCombining.jsx","../../../client/app/bundles/Diagnostic/components/questions/testQuestion.jsx","../../../client/app/bundles/Diagnostic/components/questions/question.jsx","../../../client/app/bundles/Diagnostic/components/shared/questionListByConcept.tsx","../../../client/app/bundles/Diagnostic/components/questions/questions.jsx","../../../client/app/bundles/Diagnostic/components/sentenceFragments/chooseModelContainer.jsx","../../../client/app/bundles/Diagnostic/components/sentenceFragments/sentenceFragmentForm.jsx","../../../client/app/bundles/Diagnostic/components/sentenceFragments/newSentenceFragment.jsx","../../../client/app/bundles/Diagnostic/components/renderForQuestions/answerState.ts","../../../client/app/bundles/Diagnostic/components/renderForQuestions/feedback.tsx","../../../client/app/bundles/Diagnostic/components/sentenceFragments/sentenceFragmentTemplateComponent.tsx","../../../client/app/bundles/Diagnostic/components/diagnostics/sentenceFragment.jsx","../../../client/app/bundles/Diagnostic/components/sentenceFragments/testSentenceFragmentContainer.jsx","../../../client/app/bundles/Diagnostic/components/sentenceFragments/sentenceFragment.jsx","../../../client/app/bundles/Diagnostic/components/sentenceFragments/sentenceFragments.jsx","../../../client/app/bundles/Diagnostic/components/diagnostics/finishedDiagnostic.jsx","../../../client/app/bundles/Diagnostic/components/diagnostics/landing.jsx","../../../client/app/bundles/Diagnostic/components/turk/finishedDiagnostic.jsx","../../../client/app/bundles/Diagnostic/libs/formattedCues.js","../../../client/app/bundles/Diagnostic/libs/conceptResults/fillInTheBlanks.js","../../../client/app/bundles/Diagnostic/libs/conceptResults/sentenceCombining.js","../../../client/app/bundles/Diagnostic/libs/conceptResults/sharedConceptResultsFunctions.js","../../../client/app/bundles/Diagnostic/libs/conceptResults/sentenceFragment.js","../../../client/app/bundles/Diagnostic/libs/conceptResults/diagnostic.js","../../../client/app/bundles/Diagnostic/utils/saveSession.tsx","../../../client/app/bundles/Diagnostic/libs/calculateProgress.ts","../../../client/app/bundles/Diagnostic/components/diagnostics/studentDiagnostic.jsx","../../../client/app/bundles/Diagnostic/components/eslDiagnostic/finishedDiagnostic.jsx","../../../client/app/bundles/Shared/libs/translations/modules/languagePageInfo.js","../../../client/app/bundles/Diagnostic/components/eslDiagnostic/landingPage.jsx","../../../client/app/bundles/Diagnostic/components/eslDiagnostic/sentenceCombining.jsx","../../../client/app/bundles/Diagnostic/components/eslDiagnostic/sentenceFragment.jsx","../../../client/app/bundles/Shared/libs/translations/modules/commonText.js","../../../client/app/bundles/Diagnostic/components/eslDiagnostic/titleCard.tsx","../../../client/app/bundles/Diagnostic/components/eslDiagnostic/studentDiagnostic.jsx","../../../client/app/bundles/Diagnostic/components/shared/diagnosticRouter.tsx","../../../client/app/bundles/Diagnostic/components/titleCards/showTitleCard.tsx","../../../client/app/bundles/Diagnostic/components/titleCards/titleCardForm.tsx","../../../client/app/bundles/Diagnostic/components/titleCards/titleCards.tsx","../../../client/app/bundles/Diagnostic/components/admin/admin.jsx","../../../client/app/bundles/Diagnostic/routes.tsx","../../../client/app/bundles/Diagnostic/components/home.tsx","../../../client/app/bundles/Diagnostic/utils/backOff.js","../../../client/app/bundles/Diagnostic/reducers/classroomLesson.js","../../../client/app/bundles/Diagnostic/reducers/classroomLessons.js","../../../client/app/bundles/Diagnostic/reducers/classroomLessonsReviews.js","../../../client/app/bundles/Diagnostic/reducers/classroomSessions.js","../../../client/app/bundles/Diagnostic/reducers/concepts.ts","../../../client/app/bundles/Diagnostic/reducers/conceptsFeedback.ts","../../../client/app/bundles/Diagnostic/reducers/customize.js","../../../client/app/bundles/Diagnostic/reducers/diagnostics.js","../../../client/app/bundles/Diagnostic/reducers/display.js","../../../client/app/bundles/Diagnostic/reducers/fillInBlank.ts","../../../client/app/bundles/Diagnostic/reducers/filtersReducer.js","../../../client/app/bundles/Diagnostic/reducers/generatedIncorrectSequences.js","../../../client/app/bundles/Diagnostic/reducers/lessons.ts","../../../client/app/bundles/Diagnostic/reducers/massEdit.js","../../../client/app/bundles/Diagnostic/reducers/questionReducer.js","../../../client/app/bundles/Diagnostic/reducers/questionReducerV2.js","../../../client/app/bundles/Diagnostic/reducers/questions.ts","../../../client/app/bundles/Diagnostic/reducers/responsesReducer.js","../../../client/app/bundles/Diagnostic/reducers/sentenceFragments.ts","../../../client/app/bundles/Diagnostic/reducers/sessions.js","../../../client/app/bundles/Diagnostic/reducers/titleCards.ts","../../../client/app/bundles/Diagnostic/reducers/combined.js","../../../client/app/bundles/Diagnostic/utils/configureStore.js","../../../client/app/bundles/Diagnostic/app.tsx","../../../client/app/bundles/Diagnostic/clientRegistration.js"],"sourcesContent":["import * as React from 'react'\n\nconst ResumeOrBeginButton = ({ onClickFn, text, }) => (\n )\n\nexport { ResumeOrBeginButton }\n","import * as React from 'react';\n\nconst spinner = 'https://assets.quill.org/images/icons/loader_still.svg';\n\nclass SmartSpinner extends React.Component {\n constructor(props) {\n super(props);\n }\n\n UNSAFE_componentWillMount() {\n if (this.props.onMount) {\n this.props.onMount();\n }\n }\n\n render() {\n return (\n
\n
\n \"\"\n

{this.props.message}

\n
\n
\n );\n }\n\n}\n\nexport { SmartSpinner };\n\n","import pos from 'pos';\nimport _ from 'underscore';\n\nexport function getPartsOfSpeech (input) {\n try {\n const words = new pos.Lexer().lex(input);\n const tagger = new pos.Tagger();\n return tagger.tag(words);\n }\n catch (e) {\n return undefined;\n }\n}\n\nexport function getPartsOfSpeechTags(input){\n const wordsTags = getPartsOfSpeech(input);\n if (wordsTags) {\n return wordsTags.map((b) => {\n return b[1]\n })\n }\n\n}\n\nexport function getPartsOfSpeechWords(input){\n const wordsTags = getPartsOfSpeech(input);\n if (wordsTags) {\n return wordsTags.map((b) => {\n return b[0];\n })\n }\n}\n\nexport function getPartsOfSpeechWordsWithTags(input){\n const wordsTags = getPartsOfSpeech(input);\n if (wordsTags) {\n return wordsTags.map((b) => {\n return [b[0], b[1]];\n })\n }\n}\n\nexport function checkPOSEquivalancy (input, target) {\n const inputTags = getPartsOfSpeechTags(input);\n const targetTags = getPartsOfSpeechTags(target);\n return _.isEqual(inputTags,targetTags);\n}\n\nexport function getPOSTagPairs (input, target) {\n const inputTags = getPartsOfSpeechTags(input);\n const targetTags = getPartsOfSpeechTags(target);\n return _.zip(inputTags, targetTags);\n}\n\nexport function getPOSTransformations(input, target) {\n const arraytagger = getPOSTagPairs(input, target);\n const arrayDifference = arraytagger.filter((b) => {\n return b[0] !== b[1];\n });\n return arrayDifference.map((b) => {\n return b[0] + '|' + b[1];\n });\n}\n","import _ from 'underscore';\nimport {Response, PartialResponse} from '../../interfaces';\nimport {getPartsOfSpeechTags} from '../algorithms/partsOfSpeech';\n\nexport function partsOfSpeechMatch(response: string, responses:Array):PartialResponse|undefined {\n const correctPOSTags = getGradedResponses(responses).map(\n optimalResponse => getPartsOfSpeechTags(optimalResponse.text)\n );\n // convert user submission to POS string\n const userPOSTags = getPartsOfSpeechTags(response);\n // if user string could be converted to POS tags find response that has the same POS tags\n if (userPOSTags) {\n return _.find(getGradedResponses(responses), (optimalResponse, index) => {\n if (optimalResponse.parent_id) {\n return false;\n } else if (correctPOSTags[index]) {\n if (JSON.stringify(correctPOSTags[index]) === JSON.stringify(userPOSTags)) {\n // this will return the response object\n return true;\n }\n }\n });\n }\n}\n\nexport function partsOfSpeechChecker(responseString: string, responses:Array):PartialResponse|undefined {\n const match = partsOfSpeechMatch(responseString, responses);\n if (match) {\n return partsOfSpeechResponseBuilder(responses, match)\n }\n}\n\nexport function partsOfSpeechResponseBuilder(responses:Array, match): PartialResponse {\n const res = {\n optimal: match.optimal,\n parent_id: match.id,\n author: match.author,\n feedback: match.feedback,\n concept_results: match.concept_results\n }\n return res\n}\n\nexport function getGradedResponses(responses:Array) {\n // returns sorted collection optimal first followed by suboptimal\n const gradedResponses = responses.filter(response =>\n (response.optimal !== undefined) || (!response.parent_id)\n );\n return _.sortBy(gradedResponses, 'optimal').reverse();\n}\n","import * as _ from 'underscore'\n\nimport {Response, IncorrectSequence, FocusPoint} from '../../interfaces'\nimport {conceptResultTemplate} from '../helpers/concept_result_template'\nimport {exactMatch} from '../matchers/exact_match';\nimport {focusPointChecker} from '../matchers/focus_point_match'\nimport {incorrectSequenceChecker} from '../matchers/incorrect_sequence_match'\nimport {lengthChecker} from '../matchers/length_match'\nimport {punctuationEndChecker} from '../matchers/punctuation_end_match'\nimport {caseStartChecker} from '../matchers/case_start_match'\nimport {caseInsensitiveChecker} from '../matchers/case_insensitive_match'\nimport {punctuationInsensitiveChecker} from '../matchers/punctuation_insensitive_match'\nimport {punctuationAndCaseInsensitiveChecker} from '../matchers/punctuation_and_case_insensitive_match'\nimport {spacingBeforePunctuationChecker} from '../matchers/spacing_before_punctuation_match'\nimport {spacingAfterCommaChecker} from '../matchers/spacing_after_comma_match'\nimport {requiredWordsChecker} from '../matchers/required_words_match'\nimport {partsOfSpeechChecker} from '../matchers/parts_of_speech_match'\n\nexport async function checkDiagnosticSentenceFragment(hash:{\n question_uid: string,\n response: string,\n responses: Array,\n wordCountChange?: Object,\n ignoreCaseAndPunc?: Boolean,\n incorrectSequences?: Array,\n focusPoints?: Array,\n prompt: string,\n checkML?: Boolean,\n mlUrl?: string,\n defaultConceptUID?: string\n}): Promise {\n\n const data = {\n response: hash.response.trim().replace(/\\s{2,}/g, ' '),\n responses: _.sortBy(hash.responses, r => r.count).reverse(),\n incorrectSequences: hash.incorrectSequences,\n focusPoints: hash.focusPoints,\n wordCountChange: hash.wordCountChange,\n ignoreCaseAndPunc: hash.ignoreCaseAndPunc,\n prompt: hash.prompt,\n mlUrl: hash.mlUrl,\n checkML: hash.checkML,\n question_uid: hash.question_uid\n }\n\n const responseTemplate = {\n text: data.response,\n question_uid: hash.question_uid,\n count: 1,\n concept_results: hash.defaultConceptUID ? [conceptResultTemplate(hash.defaultConceptUID)] : []\n };\n\n const firstPass = checkForMatches(data, firstPassMatchers)\n if (firstPass) {\n const newResponse = Object.assign(responseTemplate, firstPass)\n if (['Punctuation End Hint', 'Capitalization Hint', 'Punctuation Hint', 'Punctuation and Case Hint', 'Spacing After Comma Hint'].includes(newResponse.author)) {\n newResponse.concept_results = hash.defaultConceptUID ? [conceptResultTemplate(hash.defaultConceptUID)] : []\n }\n return newResponse\n } else {\n return responseTemplate;\n }\n}\n\nfunction* firstPassMatchers(data, spellCorrected=false) {\n const {response, responses, incorrectSequences, focusPoints, ignoreCaseAndPunc, wordCountChange, prompt, checkML, mlUrl} = data;\n const submission = response;\n\n yield exactMatch(submission, responses)\n yield focusPointChecker(submission, focusPoints, responses)\n yield incorrectSequenceChecker(submission, incorrectSequences, responses)\n yield partsOfSpeechChecker(submission, responses)\n if (!ignoreCaseAndPunc) {\n yield lengthChecker(submission, responses, prompt, wordCountChange)\n yield punctuationEndChecker(submission, responses)\n yield caseStartChecker(submission, responses)\n yield caseInsensitiveChecker(submission, responses)\n yield punctuationInsensitiveChecker(submission, responses)\n yield punctuationAndCaseInsensitiveChecker(submission, responses)\n yield spacingBeforePunctuationChecker(submission, responses)\n yield spacingAfterCommaChecker(submission, responses)\n yield requiredWordsChecker(submission, responses)\n }\n}\n\nfunction checkForMatches(data, matchingFunction: Function) {\n const gen = matchingFunction(data)\n let next = gen.next();\n while (true) {\n if (next.value || next.done) {\n break;\n }\n next = gen.next();\n }\n if (next.value) {\n return next.value;\n }\n\n}\n","import _ from 'underscore';\n\nimport { requestGet, } from '../../../modules/request/index';\n\nimport C from '../constants';\n\nconst conceptsEndpoint = `${window.postbuildEnv.DEFAULT_URL}/api/v1/concepts.json`;\n\nfunction splitInLevels(concepts) {\n return _.groupBy(concepts, 'level');\n}\n\nfunction getParentName(concept, concepts) {\n const parent = _.find(concepts['1'], { id: concept.parent_id, });\n const grandParent = _.find(concepts['2'], { id: parent.parent_id, });\n return `${grandParent.name} | ${parent.name}`;\n}\n\nconst actions = {\n startListeningToConcepts() {\n return (dispatch) => {\n requestGet(conceptsEndpoint, (body) => {\n const concepts = splitInLevels(body.concepts);\n concepts['0'] = concepts['0'].map((concept) => {\n concept.displayName = `${getParentName(concept, concepts)} | ${concept.name}`;\n return concept;\n });\n dispatch({ type: C.RECEIVE_CONCEPTS_DATA, data: concepts, });\n });\n\n };\n },\n};\n\nexport default actions;\n","import { push } from 'react-router-redux';\nimport C from '../constants';\nimport { Question } from '../interfaces/questions';\nimport {\n FILL_IN_BLANKS_TYPE,\n FocusPointApi,\n IncorrectSequenceApi,\n QuestionApi\n} from '../libs/questions_api';\nimport { submitResponse } from './responses';\nimport sessionActions from './sessions';\n\nfunction startListeningToQuestions() {\n return loadQuestions();\n}\n\nfunction loadQuestions() {\n return (dispatch, getState) => {\n QuestionApi.getAll(FILL_IN_BLANKS_TYPE).then((questions) => {\n dispatch({ type: C.RECEIVE_FILL_IN_BLANK_QUESTIONS_DATA, data: questions, });\n });\n };\n}\n\nfunction loadQuestion(uid) {\n return (dispatch, getState) => {\n QuestionApi.get(uid).then((question: Question) => {\n dispatch({ type: C.RECEIVE_FILL_IN_BLANK_QUESTION_DATA, uid: uid, data: question, });\n });\n }\n}\n\nfunction loadSpecifiedQuestions(uids) {\n return (dispatch, getState) => {\n const requestPromises: Promise[] = [];\n uids.forEach((uid) => {\n requestPromises.push(QuestionApi.get(uid));\n });\n const allPromises = Promise.all(requestPromises);\n const questionData = {};\n allPromises.then((results) => {\n results.forEach((result, index) => {\n questionData[uids[index]] = result;\n });\n sessionActions.populateQuestions(\"FB\", questionData, true)\n dispatch({ type: C.RECEIVE_FILL_IN_BLANK_QUESTIONS_DATA, data: questionData, });\n });\n }\n}\n\nfunction startQuestionEdit(qid) {\n return { type: C.START_FILL_IN_BLANK_QUESTION_EDIT, qid, };\n}\n\nfunction cancelQuestionEdit(qid) {\n return { type: C.FINISH_FILL_IN_BLANK_QUESTION_EDIT, qid, };\n}\n\nfunction submitQuestionEdit(qid, content) {\n return (dispatch, getState) => {\n dispatch({ type: C.SUBMIT_FILL_IN_BLANK_QUESTION_EDIT, qid, });\n QuestionApi.update(qid, content).then( () => {\n dispatch({ type: C.FINISH_FILL_IN_BLANK_QUESTION_EDIT, qid, });\n dispatch(loadQuestion(qid));\n dispatch({ type: C.DISPLAY_MESSAGE, message: 'Update successfully saved!', });\n }).catch((error) => {\n dispatch({ type: C.FINISH_FILL_IN_BLANK_QUESTION_EDIT, qid, });\n dispatch({ type: C.DISPLAY_ERROR, error: `Update failed! ${error}`, });\n });\n };\n}\n\nfunction toggleNewQuestionModal() {\n return { type: C.TOGGLE_NEW_FILL_IN_BLANK_QUESTION_MODAL, };\n}\n\nfunction submitNewQuestion(content, response) {\n return (dispatch, getState) => {\n dispatch({ type: C.AWAIT_NEW_FILL_IN_BLANK_QUESTION_RESPONSE, });\n QuestionApi.create(FILL_IN_BLANKS_TYPE, content).then((question) => {\n dispatch({ type: C.RECEIVE_NEW_FILL_IN_BLANK_QUESTION_RESPONSE, });\n response.questionUID = Object.keys(question)[0];\n response.gradeIndex = `human${response.questionUID}`;\n dispatch(submitResponse(response));\n dispatch(loadQuestion(response.questionUID));\n dispatch({ type: C.DISPLAY_MESSAGE, message: 'Submission successfully saved!', });\n const action = push(`/admin/questions/${response.questionUID}`);\n dispatch(action);\n }, (error) => {\n dispatch({ type: C.RECEIVE_NEW_FILL_IN_BLANK_QUESTION_RESPONSE, });\n dispatch({ type: C.DISPLAY_ERROR, error: `Submission failed! ${error}`, });\n });\n };\n}\n\nfunction submitNewFocusPoint(qid, data) {\n return (dispatch, getState) => {\n FocusPointApi.create(qid, data).then(() => {\n dispatch(loadQuestion(qid));\n }, (error) => {\n alert(`Submission failed! ${error}`);\n });\n }\n}\n\nfunction submitEditedFocusPoint(qid, data, fpid) {\n return (dispatch, getState) => {\n FocusPointApi.update(qid, fpid, data).then(() => {\n dispatch(loadQuestion(qid));\n }).catch((error) => {\n alert(`Submission failed! ${error}`);\n });\n };\n}\n\nfunction submitBatchEditedFocusPoint(qid, data) {\n return (dispatch, getState) => {\n FocusPointApi.updateAllForQuestion(qid, data).then(() => {\n dispatch(loadQuestion(qid));\n }).catch((error) => {\n alert(`Submission failed! ${error}`);\n });\n };\n}\n\nfunction deleteFocusPoint(qid, fpid) {\n return (dispatch, getState) => {\n FocusPointApi.remove(qid, fpid).then(() => {\n dispatch(loadQuestion(qid));\n }, (error) => {\n alert(`Delete failed! ${error}`);\n });\n };\n}\n\nfunction submitNewIncorrectSequence(qid, data) {\n return (dispatch, getState) => {\n IncorrectSequenceApi.create(qid, data).then(() => {\n dispatch(loadQuestion(qid));\n }, (error) => {\n alert(`Submission failed! ${error}`);\n });\n };\n}\n\nfunction submitEditedIncorrectSequence(qid, data, seqid) {\n return (dispatch, getState) => {\n IncorrectSequenceApi.update(qid, seqid, data).then(() => {\n dispatch(loadQuestion(qid));\n }).catch((error) => {\n alert(`Submission failed! ${error}`);\n });\n };\n}\n\nfunction deleteIncorrectSequence(qid, seqid) {\n return (dispatch, getState) => {\n IncorrectSequenceApi.remove(qid, seqid).then(() => {\n dispatch(loadQuestion(qid));\n }, (error) => {\n alert(`Delete failed! ${error}`);\n });\n };\n}\n\nexport default {\n startListeningToQuestions,\n loadQuestions,\n loadQuestion,\n loadSpecifiedQuestions,\n startQuestionEdit,\n cancelQuestionEdit,\n submitQuestionEdit,\n submitNewIncorrectSequence,\n submitEditedIncorrectSequence,\n deleteIncorrectSequence,\n toggleNewQuestionModal,\n submitNewQuestion,\n submitNewFocusPoint,\n submitEditedFocusPoint,\n submitBatchEditedFocusPoint,\n deleteFocusPoint\n};\n","import { requestDelete, requestGet, requestPost, requestPut } from '../../../modules/request/index';\nimport { Lesson, Lessons } from '../interfaces/lessons';\n\nconst lessonApiBaseUrl = `${window.postbuildEnv.DEFAULT_URL}/api/v1/lessons`;\n\nconst TYPE_CONNECT_LESSON = 'connect_lesson'\nconst TYPE_DIAGNOSTIC_LESSON = 'diagnostic_lesson'\n\nclass LessonApi {\n static getAll(lesson_type: string): Promise {\n return requestGet(`${lessonApiBaseUrl}.json?lesson_type=${lesson_type}`, null, (error) => {throw(error)});\n }\n\n static get(lesson_type: string, uid: string): Promise {\n return requestGet(`${lessonApiBaseUrl}/${uid}.json`, null, (error) => {throw(error)});\n }\n\n static create(lesson_type: string, data: Lesson): Promise {\n return requestPost(`${lessonApiBaseUrl}.json?lesson_type=${lesson_type}`, {lesson: data}, null, (error) => {throw(error)});\n }\n\n static update(lesson_type: string, uid: string, data: Lesson): Promise {\n return requestPut(`${lessonApiBaseUrl}/${uid}.json`, {lesson: data}, null, (error) => {throw(error)});\n }\n\n static remove(lesson_type: string, uid: string): Promise {\n return requestDelete(`${lessonApiBaseUrl}/${uid}.json`, null, null, (error) => {throw(error)});\n }\n}\n\nexport {\n LessonApi,\n TYPE_CONNECT_LESSON,\n TYPE_DIAGNOSTIC_LESSON,\n lessonApiBaseUrl\n};\n\n","import { push } from 'react-router-redux';\nimport C from '../constants';\nimport { Question } from '../interfaces/questions';\nimport {\n FocusPointApi,\n IncorrectSequenceApi,\n QuestionApi,\n SENTENCE_FRAGMENTS_TYPE\n} from '../libs/questions_api';\nimport { submitResponse } from './responses';\nimport sessionActions from './sessions';\n\nfunction startListeningToSentenceFragments() {\n return loadSentenceFragments();\n}\n\nfunction loadSentenceFragments() {\n return (dispatch, getState) => {\n QuestionApi.getAll(SENTENCE_FRAGMENTS_TYPE).then((questions) => {\n dispatch({ type: C.RECEIVE_SENTENCE_FRAGMENTS_DATA, data: questions, });\n });\n };\n}\n\nfunction loadSentenceFragment(uid) {\n return (dispatch, getState) => {\n QuestionApi.get(uid).then((question: Question) => {\n dispatch({ type: C.RECEIVE_SENTENCE_FRAGMENT_DATA, uid: uid, data: question, });\n });\n }\n}\n\nfunction loadSpecifiedSentenceFragments(uids) {\n return (dispatch, getState) => {\n const requestPromises: Promise[] = [];\n uids.forEach((uid) => {\n requestPromises.push(QuestionApi.get(uid));\n });\n const allPromises = Promise.all(requestPromises);\n const questionData = {};\n allPromises.then((results) => {\n results.forEach((result, index) => {\n questionData[uids[index]] = result;\n });\n sessionActions.populateQuestions(\"SF\", questionData, true)\n dispatch({ type: C.RECEIVE_SENTENCE_FRAGMENTS_DATA, data: questionData, });\n });\n }\n}\n\nfunction startSentenceFragmentEdit(sfid) {\n return { type: C.START_SENTENCE_FRAGMENT_EDIT, sfid, };\n}\nfunction cancelSentenceFragmentEdit(sfid) {\n return { type: C.FINISH_SENTENCE_FRAGMENT_EDIT, sfid, };\n}\n\nfunction submitSentenceFragmentEdit(sfid, content) {\n return (dispatch, getState) => {\n dispatch({ type: C.SUBMIT_SENTENCE_FRAGMENT_EDIT, sfid, });\n QuestionApi.update(sfid, content).then( () => {\n dispatch({ type: C.FINISH_SENTENCE_FRAGMENT_EDIT, sfid, });\n dispatch(loadSentenceFragment(sfid));\n dispatch({ type: C.DISPLAY_MESSAGE, message: 'Update successfully saved!', });\n }).catch((error) => {\n dispatch({ type: C.FINISH_QUESTION_EDIT, sfid, });\n dispatch({ type: C.DISPLAY_ERROR, error: `Update failed! ${error}`, });\n });\n };\n}\n\nfunction getUsedSequences(qid) {\n return (dispatch, getState) => {\n const existingIncorrectSeqs = getState().sentenceFragments.data[qid].incorrectSequences\n const usedSeqs: string[] = []\n if (existingIncorrectSeqs) {\n Object.values(existingIncorrectSeqs).forEach((inSeq: any) => {\n const phrases = inSeq.text.split('|||')\n phrases.forEach((p) => {\n usedSeqs.push(p)\n })\n })\n }\n dispatch(setUsedSequences(qid, usedSeqs));\n }\n}\n\nfunction submitNewIncorrectSequence(sfid, data) {\n return (dispatch, getState) => {\n IncorrectSequenceApi.create(sfid, data).then(() => {\n dispatch(loadSentenceFragment(sfid));\n }, (error) => {\n alert(`Submission failed! ${error}`);\n });\n };\n}\n\nfunction submitEditedIncorrectSequence(sfid, data, sesfid) {\n return (dispatch, getState) => {\n IncorrectSequenceApi.update(sfid, sesfid, data).then(() => {\n dispatch(loadSentenceFragment(sfid));\n }).catch((error) => {\n alert(`Submission failed! ${error}`);\n });\n };\n}\n\nfunction deleteIncorrectSequence(sfid, sesfid) {\n return (dispatch, getState) => {\n IncorrectSequenceApi.remove(sfid, sesfid).then(() => {\n dispatch(loadSentenceFragment(sfid));\n }, (error) => {\n alert(`Delete failed! ${error}`);\n });\n };\n}\n\nfunction toggleNewSentenceFeedbackModal() {\n return { type: C.TOGGLE_NEW_SENTENCE_FRAGMENT_MODAL, };\n}\n\nfunction submitNewSentenceFragment(content, response) {\n return (dispatch, getState) => {\n dispatch({ type: C.AWAIT_NEW_QUESTION_RESPONSE, });\n QuestionApi.create(SENTENCE_FRAGMENTS_TYPE, content).then((question) => {\n dispatch({ type: C.RECEIVE_NEW_QUESTION_RESPONSE, });\n response.questionUID = Object.keys(question)[0];\n response.gradeIndex = `human${response.questionUID}`;\n dispatch(submitResponse(response));\n dispatch(loadSentenceFragment(response.questionUID));\n dispatch({ type: C.DISPLAY_MESSAGE, message: 'Submission successfully saved!', });\n const action = push(`/admin/questions/${response.questionUID}`);\n dispatch(action);\n }, (error) => {\n dispatch({ type: C.RECEIVE_NEW_QUESTION_RESPONSE, });\n dispatch({ type: C.DISPLAY_ERROR, error: `Submission failed! ${error}`, });\n });\n };\n}\n\nfunction submitNewFocusPoint(sfid, data) {\n return (dispatch, getState) => {\n FocusPointApi.create(sfid, data).then(() => {\n dispatch(loadSentenceFragment(sfid));\n }, (error) => {\n alert(`Submission failed! ${error}`);\n });\n }\n}\n\nfunction submitEditedFocusPoint(sfid, data, fpid) {\n return (dispatch, getState) => {\n FocusPointApi.update(sfid, fpid, data).then(() => {\n dispatch(loadSentenceFragment(sfid));\n }).catch((error) => {\n alert(`Submission failed! ${error}`);\n });\n };\n}\n\nfunction submitBatchEditedFocusPoint(sfid, data) {\n return (dispatch, getState) => {\n FocusPointApi.updateAllForQuestion(sfid, data).then(() => {\n dispatch(loadSentenceFragment(sfid));\n }).catch((error) => {\n alert(`Submission failed! ${error}`);\n });\n };\n}\n\nfunction deleteFocusPoint(sfid, fpid) {\n return (dispatch, getState) => {\n FocusPointApi.remove(sfid, fpid).then(() => {\n dispatch(loadSentenceFragment(sfid));\n }, (error) => {\n alert(`Delete failed! ${error}`);\n });\n };\n}\n\nfunction setUsedSequences(qid, seq) {\n return {type: C.SET_USED_SEQUENCES, qid, seq}\n}\nfunction startResponseEdit(sfid, rid) {\n return { type: C.START_RESPONSE_EDIT, sfid, rid, };\n}\nfunction cancelResponseEdit(sfid, rid) {\n return { type: C.FINISH_RESPONSE_EDIT, sfid, rid, };\n}\nfunction startChildResponseView(sfid, rid) {\n return { type: C.START_CHILD_RESPONSE_VIEW, sfid, rid, };\n}\nfunction cancelChildResponseView(sfid, rid) {\n return { type: C.CANCEL_CHILD_RESPONSE_VIEW, sfid, rid, };\n}\nfunction startFromResponseView(sfid, rid) {\n return { type: C.START_FROM_RESPONSE_VIEW, sfid, rid, };\n}\nfunction cancelFromResponseView(sfid, rid) {\n return { type: C.CANCEL_FROM_RESPONSE_VIEW, sfid, rid, };\n}\nfunction startToResponseView(sfid, rid) {\n return { type: C.START_TO_RESPONSE_VIEW, sfid, rid, };\n}\nfunction cancelToResponseView(sfid, rid) {\n return { type: C.CANCEL_TO_RESPONSE_VIEW, sfid, rid, };\n}\n\nexport default {\n startListeningToSentenceFragments,\n loadSentenceFragments,\n loadSentenceFragment,\n loadSpecifiedSentenceFragments,\n startSentenceFragmentEdit,\n cancelSentenceFragmentEdit,\n submitSentenceFragmentEdit,\n submitNewIncorrectSequence,\n submitEditedIncorrectSequence,\n deleteIncorrectSequence,\n getUsedSequences,\n toggleNewSentenceFeedbackModal,\n submitNewSentenceFragment,\n submitNewFocusPoint,\n submitEditedFocusPoint,\n submitBatchEditedFocusPoint,\n deleteFocusPoint,\n startResponseEdit,\n cancelResponseEdit,\n startChildResponseView,\n cancelChildResponseView,\n startFromResponseView,\n cancelFromResponseView,\n startToResponseView,\n cancelToResponseView\n};\n","import { push } from 'react-router-redux';\nimport sessionActions from './sessions';\n\nimport C from '../constants';\nimport { DIAGNOSTIC_TITLE_CARD_TYPE, TitleCardApi } from '../../Shared';\nimport { TitleCard } from '../interfaces/titleCard';\n\n\nfunction startListeningToTitleCards() {\n return loadTitleCards();\n}\n\nfunction loadTitleCards(): (any) => void {\n return (dispatch) => {\n TitleCardApi.getAll(DIAGNOSTIC_TITLE_CARD_TYPE).then((body) => {\n let titleCards = body.title_cards || []\n const titleCardsObject = titleCards.reduce((obj, item) => {\n return Object.assign(obj, {[item.uid]: item});\n }, {});\n dispatch({ type: C.RECEIVE_TITLE_CARDS_DATA, data: titleCardsObject, });\n });\n };\n}\n\nfunction loadSpecifiedTitleCards(uids) {\n return (dispatch, getState) => {\n const requestPromises: Promise[] = [];\n uids.forEach((uid) => {\n requestPromises.push(TitleCardApi.get(DIAGNOSTIC_TITLE_CARD_TYPE, uid));\n });\n const allPromises: Promise = Promise.all(requestPromises);\n const questionData = {};\n allPromises.then((results) => {\n results.forEach((result) => {\n questionData[result.uid] = result;\n });\n sessionActions.populateQuestions(\"TL\", questionData, true)\n dispatch({ type: C.RECEIVE_TITLE_CARDS_DATA, data: questionData, });\n });\n }\n}\n\nfunction submitNewTitleCard(content) {\n return (dispatch) => {\n TitleCardApi.create(DIAGNOSTIC_TITLE_CARD_TYPE, content).then((body) => {\n dispatch({ type: C.RECEIVE_TITLE_CARDS_DATA_UPDATE, data: {[body.uid]: body} });\n const action = push(`/admin/title-cards/${body.uid}`);\n dispatch(action);\n })\n .catch((body) => {\n dispatch({ type: C.DISPLAY_ERROR, error: `Submission failed! ${body}`, });\n });\n };\n}\n\nfunction submitTitleCardEdit(uid, content) {\n return (dispatch, getState) => {\n TitleCardApi.update(DIAGNOSTIC_TITLE_CARD_TYPE, uid, content).then((body) => {\n dispatch({ type: C.RECEIVE_TITLE_CARDS_DATA_UPDATE, data: {[body.uid]: body} });\n dispatch({ type: C.DISPLAY_MESSAGE, message: 'Update successfully saved!', });\n const action = push(`/admin/title-cards/${uid}`);\n dispatch(action);\n }).catch((body) => {\n dispatch({ type: C.DISPLAY_ERROR, error: `Update failed! ${body}`, });\n });\n };\n}\n\nexport {\n loadSpecifiedTitleCards, loadTitleCards, startListeningToTitleCards, submitNewTitleCard, submitTitleCardEdit\n};\n\n","import { pickBy } from 'lodash';\nimport { push } from 'react-router-redux';\nimport C from '../constants';\nimport { LessonApi, TYPE_DIAGNOSTIC_LESSON } from '../libs/lessons_api';\nimport fillInBlankActions from './fillInBlank';\nimport questionActions from './questions';\nimport sentenceFragmentActions from './sentenceFragments.ts';\nimport * as titleCardActions from './titleCards.ts';\nimport { reloadQuestionsIfNecessary } from '../../Shared/actions/questions';\nimport { DIAGNOSTIC } from '../../Shared';\n\n// called when the app starts. this means we immediately download all quotes, and\n// then receive all quotes again as soon as anyone changes anything.\n\nconst startListeningToLessons = () => {\n return loadLessons()\n}\n\nconst loadLessons = () => {\n return (dispatch, getState) => {\n LessonApi.getAll(TYPE_DIAGNOSTIC_LESSON).then((data) => {\n dispatch({ type: C.RECEIVE_LESSONS_DATA, data: data, });\n });\n };\n}\n\nconst loadLesson = (uid) => {\n return (dispatch, getState) => {\n return new Promise((resolve, reject) => {\n LessonApi.get(TYPE_DIAGNOSTIC_LESSON, uid).then((data) => {\n dispatch({ type: C.RECEIVE_LESSONS_DATA, data: { [uid]: data, } });\n resolve();\n });\n })\n }\n}\n\nconst loadLessonWithQuestions = (uid) => {\n return (dispatch, getState) => {\n dispatch(loadLesson(uid)).then(() => {\n const fetchedLesson = getState().lessons.data[uid];\n const questionTypes = ['questions', 'fillInBlank', 'titleCards', 'sentenceFragments'];\n questionTypes.forEach((questionType) => {\n const questionUids = fetchedLesson.questions.filter((q) => q.questionType == questionType).map((q) => q.key);\n switch (questionType) {\n case 'questions':\n dispatch(questionActions.loadSpecifiedQuestions(questionUids));\n break\n case 'fillInBlank':\n dispatch(fillInBlankActions.loadSpecifiedQuestions(questionUids));\n break\n case 'titleCards':\n dispatch(titleCardActions.loadSpecifiedTitleCards(questionUids));\n break\n case 'sentenceFragments':\n dispatch(sentenceFragmentActions.loadSpecifiedSentenceFragments(questionUids));\n }\n });\n });\n }\n}\n\nconst startLessonEdit = (cid) => {\n return { type: C.START_LESSON_EDIT, cid, };\n}\n\nconst cancelLessonEdit = (cid) => {\n return { type: C.FINISH_LESSON_EDIT, cid, };\n}\n\nconst deleteLesson = (cid) => {\n return (dispatch, getState) => {\n dispatch({ type: C.SUBMIT_LESSON_EDIT, cid, });\n LessonApi.remove(TYPE_DIAGNOSTIC_LESSON, cid).then(() => {\n dispatch({ type: C.FINISH_LESSON_EDIT, cid, });\n dispatch({ type: C.DISPLAY_MESSAGE, message: 'Lesson successfully deleted!', });\n }).catch((error) => {\n dispatch({ type: C.FINISH_LESSON_EDIT, cid, });\n dispatch({ type: C.DISPLAY_ERROR, error: `Deletion failed! ${error}`, });\n });\n };\n}\n\nconst submitLessonEdit = (cid, content, qids) => {\n return (dispatch, getState) => {\n dispatch({ type: C.SUBMIT_LESSON_EDIT, cid, });\n const cleanedContent = pickBy(content)\n dispatch(updateQuestions(cleanedContent, qids))\n LessonApi.update(TYPE_DIAGNOSTIC_LESSON, cid, cleanedContent).then((lesson) => {\n dispatch(loadLesson(cid))\n dispatch({ type: C.FINISH_LESSON_EDIT, cid, });\n dispatch(reloadQuestionsIfNecessary(content.flag, DIAGNOSTIC));\n dispatch({ type: C.DISPLAY_MESSAGE, message: 'Update successfully saved!', });\n }).catch((error) => {\n dispatch({ type: C.FINISH_LESSON_EDIT, cid, });\n dispatch({ type: C.DISPLAY_ERROR, error: `Update failed! ${error}`, });\n })\n };\n}\n\nconst updateQuestions = (content, qids) => {\n return (dispatch) => {\n if (content.modelConceptUID) {\n qids.forEach(qid => {\n dispatch(questionActions.updateModelConceptUID(qid, content.modelConceptUID))\n })\n }\n };\n}\n\nconst toggleNewLessonModal = () => {\n return { type: C.TOGGLE_NEW_LESSON_MODAL, };\n}\n\nconst submitNewLesson = (content) => {\n const cleanedContent = pickBy(content)\n return (dispatch, getState) => {\n dispatch({ type: C.AWAIT_NEW_LESSON_RESPONSE, });\n LessonApi.create(TYPE_DIAGNOSTIC_LESSON, cleanedContent).then((lesson) => {\n const lessonUid = Object.keys(lesson)[0];\n dispatch(loadLesson(lessonUid))\n dispatch({ type: C.RECEIVE_NEW_LESSON_RESPONSE, });\n const qids = cleanedContent.questions ? cleanedContent.questions.map(q => q.key) : []\n dispatch(updateQuestions(cleanedContent, qids))\n dispatch({ type: C.DISPLAY_MESSAGE, message: 'Submission successfully saved!', });\n const action = push(`/admin/lessons/${lessonUid}`);\n dispatch(action);\n }).catch((error) => {\n dispatch({ type: C.RECEIVE_NEW_LESSON_RESPONSE, });\n dispatch({ type: C.DISPLAY_ERROR, error: `Submission failed! ${error}`, });\n });\n };\n}\n\nexport default {\n startListeningToLessons,\n loadLesson,\n loadLessonWithQuestions,\n loadLessons,\n startLessonEdit,\n cancelLessonEdit,\n deleteLesson,\n submitLessonEdit,\n updateQuestions,\n toggleNewLessonModal,\n submitNewLesson\n};\n","import React from 'react';\nimport { connect } from 'react-redux';\nimport { LanguagePicker, renderSaveAndExitButton } from '../../../Shared';\nimport { DropdownObjectInterface } from '../../../Staff/interfaces/evidenceInterfaces';\n\nconst quillLogoSrc = `${window.postbuildEnv.CDN_URL}/images/logos/quill-logo-white-2022.svg`\n\ninterface StudentNavbarProps {\n isELLDiagnostic: boolean;\n language?: string;\n updateLanguage?: (language: string) => void;\n translate?: (language: string) => string;\n languageOptions?: DropdownObjectInterface[];\n}\n\nexport const StudentNavbar = ({ language, updateLanguage, translate, isELLDiagnostic }: StudentNavbarProps) => {\n return(\n
\n
\n
\n \n \n \n
\n
\n {language && }\n {renderSaveAndExitButton({ language, translate, isELLDiagnostic })}\n
\n
\n
\n );\n};\n\nfunction select(state) {\n return {\n playDiagnostic: state.playDiagnostic\n };\n}\n\nexport default connect(select)(StudentNavbar);\n","import * as React from \"react\";\nimport { connect } from 'react-redux';\n\nimport { TeacherPreviewMenuButton, LanguagePicker, renderSaveAndExitButton } from '../../../Shared/index';\nimport { DropdownObjectInterface } from \"../../../Staff/interfaces/evidenceInterfaces\";\n\nconst quillLogoSrc = `${window.postbuildEnv.CDN_URL}/images/logos/quill-logo-white-2022.svg`;\nconst LogoComponent = \"Quill;\n\ninterface TeacherNavbarProps {\n dispatch: (action: any) => void;\n diagnosticID: string;\n isELLDiagnostic: boolean;\n isOnMobile: boolean;\n languageMenuOpen: boolean;\n previewShowing?: boolean;\n onTogglePreview?: () => void;\n language: string;\n languageOptions: DropdownObjectInterface[];\n translate: (language: string) => string;\n updateLanguage: (language: string) => void;\n}\n\nexport const TeacherNavbar = ({\n isELLDiagnostic,\n isOnMobile,\n previewShowing,\n onTogglePreview,\n language,\n updateLanguage,\n languageOptions,\n translate,\n}: TeacherNavbarProps) => {\n\n function handleTogglePreview() { onTogglePreview() }\n\n return (\n
\n
\n {!previewShowing && !isOnMobile && }\n {LogoComponent}\n
\n {language && }\n {renderSaveAndExitButton({ language, translate, isELLDiagnostic })}\n
\n
\n
\n );\n}\n\nfunction select(state) {\n return {\n diagnosticID: state.playDiagnostic.diagnosticID,\n languageMenuOpen: state.playDiagnostic.languageMenuOpen\n };\n}\n\nexport default connect(select)(TeacherNavbar);\n","import React from 'react'\nimport {\n FlagDropdown,\n TextEditor,\n ConceptSelector,\n} from '../../../Shared/index'\n\nexport default class extends React.Component {\n state = {\n prompt: \"\",\n concept: this.props.question.conceptID,\n instructions: this.props.question.instructions ? this.props.question.instructions : \"\",\n flag: this.props.question.flag ? this.props.question.flag : \"alpha\",\n cuesLabel: this.props.question.cuesLabel ? this.props.question.cuesLabel : '',\n optimalResponseText: ''\n };\n\n submit = () => {\n const questionObj = {\n conceptUID: this.props.question.conceptUID,\n focusPoints: this.props.question.focusPoints,\n incorrectSequences: this.props.question.incorrectSequences,\n modelConceptUID: this.props.question.modelConceptUID,\n prompt: this.state.prompt,\n cues: this.refs.cues.value.split(','),\n instructions: this.state.instructions,\n flag: this.state.flag,\n cuesLabel: this.state.cuesLabel\n }\n if (this.props.new) {\n const optimalResponseObj = {text: this.state.optimalResponseText.trim(), optimal: true, count: 0, feedback: \"That's a strong sentence!\"}\n this.props.submit(questionObj, optimalResponseObj)\n } else {\n questionObj.conceptID = this.state.concept\n this.props.submit(questionObj)\n }\n };\n\n handleOptimalResponseText = (e) => {\n this.setState({ optimalResponseText: e.target.value });\n };\n\n handlePromptChange = (e) => {\n this.setState({prompt: e})\n };\n\n handleInstructionsChange = (e) => {\n this.setState({instructions: e.target.value})\n };\n\n renderConceptSelector = () => {\n if (!this.props.new) {\n return (\n
\n \n
\n \n
\n
\n )\n }\n };\n\n renderOptimalResponse = () => {\n if (this.props.new) {\n return (\n
\n \n

\n \n

\n
\n )\n }\n };\n\n handleSelectorChange = (e) => {\n this.setState({concept: e.value})\n };\n\n handleConceptChange = () => {\n this.setState({concept: this.refs.concept.value})\n };\n\n handleFlagChange = (e) => {\n this.setState({ flag: e.target.value, });\n };\n\n handleCuesLabelChange = (e) => {\n this.setState({ cuesLabel: e.target.value, });\n };\n\n render() {\n if(this.props.new || this.props.concepts.hasreceiveddata) {\n return (\n
\n
Create a new question
\n \n \n \n

\n