Skip to content
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

Merged
merged 1 commit into from
May 29, 2022
Merged

Web Site Minor Clean Up #386

merged 1 commit into from
May 29, 2022

Conversation

MrRowey
Copy link
Member

@MrRowey MrRowey commented May 29, 2022

  • 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.

-  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.
@MrRowey MrRowey merged commit b9f059b into FAForever:develop May 29, 2022
@MrRowey MrRowey deleted the Minor_Site-Updates branch May 29, 2022 15:11
Copy link
Member

@Rackover Rackover left a 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;
Copy link
Member

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);
Copy link
Member

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);
Copy link
Member

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));
Copy link
Member

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) {
Copy link
Member

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");
Copy link
Member

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");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all require() => const 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants