-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintcache
1 lines (1 loc) · 7.25 KB
/
.eslintcache
1
[{"F:\\Projects\\unit4\\src\\index.js":"1","F:\\Projects\\unit4\\src\\App.js":"2","F:\\Projects\\unit4\\src\\rootComponents.js":"3","F:\\Projects\\unit4\\src\\loginHandler.js":"4","F:\\Projects\\unit4\\src\\config.js":"5","F:\\Projects\\unit4\\src\\element\\login.js":"6","F:\\Projects\\unit4\\src\\element\\register.js":"7","F:\\Projects\\unit4\\src\\element\\game.js":"8","F:\\Projects\\unit4\\src\\element\\leaderboard.js":"9"},{"size":218,"mtime":1606671804502,"results":"10","hashOfConfig":"11"},{"size":1649,"mtime":1606676278123,"results":"12","hashOfConfig":"11"},{"size":2873,"mtime":1606671769997,"results":"13","hashOfConfig":"11"},{"size":1231,"mtime":1606671796088,"results":"14","hashOfConfig":"11"},{"size":257,"mtime":1606671607279,"results":"15","hashOfConfig":"11"},{"size":1940,"mtime":1606696667708,"results":"16","hashOfConfig":"11"},{"size":2196,"mtime":1606671847828,"results":"17","hashOfConfig":"11"},{"size":12240,"mtime":1606739405270,"results":"18","hashOfConfig":"11"},{"size":3608,"mtime":1606696401812,"results":"19","hashOfConfig":"11"},{"filePath":"20","messages":"21","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"22"},"1fj8uyf",{"filePath":"23","messages":"24","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"25"},{"filePath":"26","messages":"27","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"28"},{"filePath":"29","messages":"30","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"31","messages":"32","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"33"},{"filePath":"34","messages":"35","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"36","messages":"37","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"25"},{"filePath":"38","messages":"39","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"40","messages":"41","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"42"},"F:\\Projects\\unit4\\src\\index.js",[],["43","44"],"F:\\Projects\\unit4\\src\\App.js",[],["45","46"],"F:\\Projects\\unit4\\src\\rootComponents.js",[],["47","48"],"F:\\Projects\\unit4\\src\\loginHandler.js",[],"F:\\Projects\\unit4\\src\\config.js",[],["49","50"],"F:\\Projects\\unit4\\src\\element\\login.js",[],"F:\\Projects\\unit4\\src\\element\\register.js",[],"F:\\Projects\\unit4\\src\\element\\game.js",["51","52"],"F:\\Projects\\unit4\\src\\element\\leaderboard.js",["53"],"import React from \"react\"\r\nimport {Back} from '../rootComponents';\r\nimport {Firebase} from '../App';\r\n\r\nclass Leaderboard extends React.Component {\r\n constructor(props) {\r\n super(props);\r\n this.state = {\r\n leaderboard: <div></div>\r\n }; //create default state\r\n this.handleChange = this.handleChange.bind(this);\r\n\r\n this.level = (level) => {\r\n //this fetches users scores for a given level\r\n return Firebase.database().ref('/scores').once('value').then((snapshot) => {\r\n let data = snapshot.val()\r\n let scores = {}\r\n Object.keys(data).forEach(element => {\r\n\r\n if(data[element].level==level){\r\n\r\n if (!scores[data[element].user]) scores[data[element].user] = {score: 0};\r\n scores[data[element].user].score += data[element].score //makes an object with all the users total scores\r\n }\r\n });\r\n\r\n\r\n // end fetch user scores \r\n let userArray = []\r\n return Firebase.database().ref('/users/').once('value').then((snapshot) => { //fetches user data\r\n let data = snapshot.val()\r\n\r\n\r\n Object.keys(scores).forEach(element => { // adds the usernames to there scores\r\n scores[element].username = data[element].username;\r\n userArray.push(scores[element])\r\n })\r\n\r\n let sortedUserArray = userArray.sort(function(a, b){return b.score-a.score}); //sorts the data\r\n\r\n if (sortedUserArray[0]==null) return this.setState({leaderboard:(<h3>Their is no data for this leaderboard right now!</h3>)}) //if there is no data display error\r\n let max = 10;\r\n if (sortedUserArray.length < 10) max = sortedUserArray.length; //if there is less than 10 entrees in the leaderboard \r\n let JSX = [] \r\n for (let i = 0; i < max; i++) {\r\n JSX.push( <tr>\r\n <td>{i+1}</td>\r\n <td>{sortedUserArray[i].username}</td>\r\n <td>{sortedUserArray[i].score}</td>\r\n </tr> ) //compile the leaderboard data to be displayed\r\n }\r\n\r\n return this.setState({leaderboard:JSX}) //set the leaaderboard data\r\n })\r\n })\r\n}\r\n\r\n\r\n }\r\n handleChange(event) {\r\n this.setState({[event.target.name]:event.target.value})\r\n }\r\n componentDidMount() {\r\n this.level(0);\r\n }\r\n render() {\r\n console.log(this.state.leaderboard)\r\n return (\r\n <div>\r\n <h1 style={{textAlign: \"center\"}} styles=\"font-family: 'Lucida Console', Courier, monospace;\">Mic The Monkeys Maths Mayhem</h1>\r\n\r\n <div class=\"gameBox\">\r\n <h2>Leaderboards</h2>\r\n <button onClick={async () => {this.level(0)}} class=\"button3\">Level 0</button> \r\n <button onClick={async () => {this.level(1)}} class=\"button3\">Level 1</button>\r\n <button onClick={async () => {this.level(2)}} class=\"button3\">Level 2</button>\r\n <br />\r\n <table styles=\"width:100%\">\r\n <tr>\r\n <th>Position</th>\r\n <th>Username</th>\r\n <th>Score</th>\r\n </tr>\r\n {this.state.leaderboard}\r\n </table>\r\n \r\n \r\n </div>\r\n <Back />\r\n\r\n </div>\r\n \r\n ) //leaderboard menu\r\n }\r\n }\r\n\r\n\r\nexport default Leaderboard;",{"ruleId":"54","replacedBy":"55"},{"ruleId":"56","replacedBy":"57"},{"ruleId":"54","replacedBy":"58"},{"ruleId":"56","replacedBy":"59"},{"ruleId":"54","replacedBy":"60"},{"ruleId":"56","replacedBy":"61"},{"ruleId":"54","replacedBy":"62"},{"ruleId":"56","replacedBy":"63"},{"ruleId":"64","severity":1,"message":"65","line":19,"column":37,"nodeType":"66","messageId":"67","endLine":19,"endColumn":39},{"ruleId":"64","severity":1,"message":"65","line":19,"column":74,"nodeType":"66","messageId":"67","endLine":19,"endColumn":76},{"ruleId":"64","severity":1,"message":"65","line":20,"column":39,"nodeType":"66","messageId":"67","endLine":20,"endColumn":41},"no-native-reassign",["68"],"no-negated-in-lhs",["69"],["68"],["69"],["68"],["69"],["68"],["69"],"eqeqeq","Expected '===' and instead saw '=='.","BinaryExpression","unexpected","no-global-assign","no-unsafe-negation"]