New JSON structure transform
This commit is contained in:
parent
122ef68de9
commit
adde5e0a0e
|
@ -7,7 +7,7 @@ import TopicsList from '../topicsList';
|
|||
import ProjectsList from '../projectsList';
|
||||
import SearchBar from '../searchBar';
|
||||
import SearchResults from '../searchResults';
|
||||
import { InterviewsData, Questions } from '../../data/archives/interviews';
|
||||
import { InterviewData, Questions } from '../../data/archives/interviews';
|
||||
import './style.scss';
|
||||
|
||||
class BrowseArchives extends React.Component {
|
||||
|
@ -22,7 +22,7 @@ class BrowseArchives extends React.Component {
|
|||
isInterviewsListModalOpen: false,
|
||||
activeSingleInterviewId: 1,
|
||||
isSearchActive: false,
|
||||
interviewData: this.transformInterviews(InterviewsData),
|
||||
interviewData: this.transformInterviews(InterviewData),
|
||||
matchedCount: 0,
|
||||
};
|
||||
|
||||
|
@ -118,21 +118,21 @@ class BrowseArchives extends React.Component {
|
|||
|
||||
for (let i = 0; i < length; i++) {
|
||||
const interview = interviews[i];
|
||||
const qKeys = Object.keys(interview);
|
||||
const qKeys = Object.keys(interview); // name, who_what->question
|
||||
const interviewFormatted = [];
|
||||
|
||||
qKeys.forEach((key, index) => {
|
||||
if (key !== 'Name' && interview[key] !== null) {
|
||||
qKeys.forEach((key) => {
|
||||
if (key !== 'name' && interview[key] !== null && interview[key].answer !== null && interview[key].answer !== '') {
|
||||
interviewFormatted.push({
|
||||
question: index,
|
||||
answer: interview[key],
|
||||
question: key,
|
||||
answer: interview[key].answer,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
betterInterviews.push({
|
||||
id: i + 1,
|
||||
name: interview.Name,
|
||||
name: interview.name,
|
||||
matchedIndex: -1,
|
||||
interview: interviewFormatted,
|
||||
});
|
||||
|
|
|
@ -36,7 +36,7 @@ SingleInterview.propTypes = {
|
|||
}).isRequired,
|
||||
toggleSingleInterview: PropTypes.func.isRequired,
|
||||
questions: PropTypes.arrayOf(PropTypes.shape({
|
||||
id: PropTypes.number.isRequired,
|
||||
id: PropTypes.string.isRequired,
|
||||
text: PropTypes.string.isRequired,
|
||||
})).isRequired,
|
||||
};
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue