-
Notifications
You must be signed in to change notification settings - Fork 479
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33800 from code-dot-org/dtl_candidate_9666fd2b
- Loading branch information
Showing
71 changed files
with
1,486 additions
and
692 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...c/code-studio/pd/workshop_dashboard/components/survey_results/matrix_choice_responses.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// This component renders a survey answer for a matrix question | ||
// It will split the matrix into individual questions and display them with | ||
// the title "matrix title -> question title" | ||
|
||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import _ from 'lodash'; | ||
import ChoiceResponses from './choice_responses.jsx'; | ||
|
||
export default class MatrixChoiceResponses extends React.Component { | ||
static propTypes = { | ||
answer: PropTypes.object.isRequired, | ||
question: PropTypes.object.isRequired, | ||
section: PropTypes.string.isRequired, | ||
questionId: PropTypes.string.isRequired | ||
}; | ||
|
||
render() { | ||
const {section, answer, question, questionId} = this.props; | ||
|
||
return ( | ||
<div> | ||
{_.compact( | ||
Object.keys(question['rows']).map(innerQuestionId => { | ||
const innerAnswer = answer[innerQuestionId]; | ||
if (!innerAnswer) { | ||
return null; | ||
} | ||
const numRespondents = answer.num_respondents; | ||
let possibleAnswersMap = question['columns']; | ||
let parsedQuestionName = `${question['title']} -> ${ | ||
question['rows'][innerQuestionId] | ||
}`; | ||
return ( | ||
<ChoiceResponses | ||
perFacilitator={section === 'facilitator'} | ||
numRespondents={numRespondents} | ||
question={parsedQuestionName} | ||
answers={innerAnswer} | ||
possibleAnswers={Object.keys(possibleAnswersMap)} | ||
possibleAnswersMap={possibleAnswersMap} | ||
key={`${questionId}-${innerQuestionId}`} | ||
answerType={'singleSelect'} | ||
/> | ||
); | ||
}) | ||
)} | ||
</div> | ||
); | ||
} | ||
} |
Oops, something went wrong.