-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Web Site Minor Clean Up #386
Conversation
- Removed Tournaments.pug Page and all corresponding pages due to its main use which displayed the FAF Challonge did not work and the Challonge API was causing long load times. - Update Competitive tab to link to the Global ranks & added in 4v4 Full share - Minor Page Clean ups - Updated Main page and added GOG buy Link - Updated Account Register due to still having Steam link mandatory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ should not have been merged in this state ! ☹
locals.apiURL = process.env.API_URL; | ||
|
||
fs.readFile('members/4v4.json', 'utf8', function (err, data) { | ||
if(err) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Log error when it happens, do not fail silently 🙂
fs.readFile('members/4v4.json', 'utf8', function (err, data) { | ||
if(err) return; | ||
locals.members = JSON.parse(data); | ||
locals.lastPage = Math.ceil(locals.members.length / 100); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local.members
not checked, what if JSON.parse fails?
fs.readFile('members/4v4.json', 'utf8', function (err, data) { | ||
if(err) return; | ||
locals.members = JSON.parse(data); | ||
locals.lastPage = Math.ceil(locals.members.length / 100); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
100 needs to be a variable / constant defined somewhere, no magic/absolutes (it's the page size)
return; | ||
} | ||
|
||
const ratings = models.sync(JSON.parse(body)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check JSON.parse or wrap it in a try catch
|
||
request(process.env.API_URL + "/data/leaderboardRating?include=player&sort=-rating&filter=leaderboard.id==4;updateTime=ge=" + | ||
pastMonth.format("YYYY-MM-DDTHH:mm:ss") + "Z", function (error, response, body) { | ||
if (error || response.statusCode > 210) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is that the traditional NPM request we're using here? It's heavily deprecated if so, we should probably not use that anymore (2020)
probably not in the scope of that PR but good to keep in mind
let fs = require('fs'); | ||
let request = require("request"); | ||
let fs = require("fs"); | ||
let moment = require("moment"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all require() => const
@@ -2,7 +2,8 @@ require("dotenv").config(); | |||
|
|||
let jsonapi = require("json-api-models"); | |||
let request = require("request"); | |||
let fs = require('fs'); | |||
let fs = require("fs"); | |||
let moment = require("moment"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all require() => const 🙂
Removed Tournaments.pug Page and all corresponding pages due to its main use which displayed the FAF Challonge did not work and the Challonge API was causing long load times.
Update Competitive tab to link to the Global ranks & added in 4v4 Full share
Minor Page Clean ups
Updated Main page and added GOG buy Link
Updated Account Register due to still having Steam link mandatory.