Fixed collection bug issue. Bug was caused by ordering assumption I made.

This commit is contained in:
ajmaley 2018-12-10 16:09:30 -05:00
parent 3feec479f2
commit df5052a917
4 changed files with 29 additions and 20 deletions

14
package-lock.json generated
View File

@ -5679,7 +5679,7 @@
}, },
"core-js": { "core-js": {
"version": "2.5.5", "version": "2.5.5",
"resolved": "http://registry.npmjs.org/core-js/-/core-js-2.5.5.tgz", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.5.tgz",
"integrity": "sha1-sU3ek2xkDAV5prUMq8wTLdYSfjs=" "integrity": "sha1-sU3ek2xkDAV5prUMq8wTLdYSfjs="
}, },
"firebase": { "firebase": {
@ -12513,9 +12513,9 @@
} }
}, },
"react-cookie": { "react-cookie": {
"version": "3.0.7", "version": "3.0.8",
"resolved": "https://registry.npmjs.org/react-cookie/-/react-cookie-3.0.7.tgz", "resolved": "https://registry.npmjs.org/react-cookie/-/react-cookie-3.0.8.tgz",
"integrity": "sha512-c4lGOqIPC54kUocE7kbuqZNeIdXtZGzXQMA7BSWhaJ/5tWeoW5fJ7mF/pR+rU5fYDF9kktTHCIbovwSsNYblOg==", "integrity": "sha512-Gdop2Cf2pBFA0r4L9l5DRghKsPVMNKRM3x2aeyJ4JSaENpWWPP4v9LJvvtxXs3AboOGCuMj19oUw04Z9cVQQTg==",
"requires": { "requires": {
"@types/hoist-non-react-statics": "^3.0.1", "@types/hoist-non-react-statics": "^3.0.1",
"hoist-non-react-statics": "^3.0.0", "hoist-non-react-statics": "^3.0.0",
@ -12523,9 +12523,9 @@
}, },
"dependencies": { "dependencies": {
"hoist-non-react-statics": { "hoist-non-react-statics": {
"version": "3.2.0", "version": "3.2.1",
"resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.2.0.tgz", "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.2.1.tgz",
"integrity": "sha512-3IascCRfaEkbmHjJnUxWSspIUE1okLPjGTMVXW8zraUo1t3yg1BadKAxAGILHwgoBzmMnzrgeeaDGBvpuPz6dA==", "integrity": "sha512-TFsu3TV3YLY+zFTZDrN8L2DTFanObwmBLpWvJs1qfUuEQ5bTAdFcwfx2T/bsCXfM9QHSLvjfP+nihEl0yvozxw==",
"requires": { "requires": {
"react-is": "^16.3.2" "react-is": "^16.3.2"
} }

View File

@ -17,7 +17,7 @@
"material-ui-icons": "^1.0.0-beta.36", "material-ui-icons": "^1.0.0-beta.36",
"moment": "^2.22.2", "moment": "^2.22.2",
"react": "^16.5.1", "react": "^16.5.1",
"react-cookie": "^3.0.7", "react-cookie": "^3.0.8",
"react-dom": "^16.5.1", "react-dom": "^16.5.1",
"react-image-gallery": "^0.8.12", "react-image-gallery": "^0.8.12",
"react-quiz-component": "0.2.0", "react-quiz-component": "0.2.0",

View File

@ -1,24 +1,32 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import flamelinkApp from '../../utilities/flamelink.js'; import flamelinkApp from '../../utilities/flamelink.js';
import Grid from '@material-ui/core/Grid';
import FlameLinkCollectionComponentCreations from './FlameLinkCollectionComponentCreations'; import FlameLinkCollectionComponentCreations from './FlameLinkCollectionComponentCreations';
class FlameLinkCollection extends Component { class FlameLinkCollection extends Component {
state = { constructor(props) {
schemaContent: '', super(props);
}
this.state = {
schemaContent: '',
}
componentDidMount() {
flamelinkApp.content.get(this.props.schemaName) flamelinkApp.content.get(this.props.schemaName)
.then(result => this.setState({ .then(result => this.setState({
schemaContent: result schemaContent: result
})) }))
} }
getCollectionContent(schemaData) { getCollectionContent(schemaData) {
var arr2 = []; var arr2 = [];
var collectionInfo = [schemaData, this.state.schemaContent]; var collectionInfo = [schemaData, this.state.schemaContent];
for (var val in this.state.schemaContent) { for (var val in this.state.schemaContent) {
arr2[this.state.schemaContent[val]['order']] = val; if ( this.state.schemaContent[val].hasOwnProperty('order') ) {
arr2[this.state.schemaContent[val]['order']] = val;
}
else{
arr2.push(val);
}
} }
return arr2.map(this.getCollectionComponentInfo, collectionInfo); return arr2.map(this.getCollectionComponentInfo, collectionInfo);
} }
@ -28,6 +36,7 @@ class FlameLinkCollection extends Component {
for (var val in this[0]) { for (var val in this[0]) {
arr3.push(val); arr3.push(val);
} }
return <FlameLinkCollectionComponentCreations schemaData={this[0]} schemaContent={this[1][num]} arr={arr3} key={num} /> return <FlameLinkCollectionComponentCreations schemaData={this[0]} schemaContent={this[1][num]} arr={arr3} key={num} />
} }
@ -44,9 +53,9 @@ class FlameLinkCollection extends Component {
render() { render() {
return ( return (
<div> <Grid container>
{this.getCollectionContent(this.props.schemaData)} {this.getCollectionContent(this.props.schemaData)}
</div> </Grid>
); );
} }
} }

View File

@ -16,7 +16,7 @@ const styles = theme => ({
class About extends Component { class About extends Component {
state = { state = {
researcherSchemaName: 'martenAbout', researcherSchemaName: 'martenAbout',
developerSchemaName: 'martenAboutDev', developerSchemaName: 'martenAboutDevelopers',
researcherSchemaDetails: '', researcherSchemaDetails: '',
researcherSchemaType: '', researcherSchemaType: '',
developerSchemaDetails: '', developerSchemaDetails: '',