Apply max-line length

pull/32/head
HardiReady 2018-03-12 09:59:43 +01:00
parent a2215eff59
commit e7df8a0c94
6 changed files with 59 additions and 63 deletions

View File

@ -17,13 +17,7 @@ const AwardingModel = require('../models/awarding');
// result set for proposer(appUser) population // result set for proposer(appUser) population
const resultSet = { const resultSet = {
'__v': 0, '__v': 0, 'updatedAt': 0, 'timestamp': 0, 'password': 0, 'permission': 0, 'secret': 0, 'activated': 0,
'updatedAt': 0,
'timestamp': 0,
'password': 0,
'permission': 0,
'secret': 0,
'activated': 0,
}; };
const awarding = express.Router(); const awarding = express.Router();
@ -56,12 +50,13 @@ awarding.route('/')
}); });
} else { } else {
AwardingModel.find(filter, {}, {sort: {date: 'desc'}}) AwardingModel.find(filter, {}, {sort: {date: 'desc'}})
.populate('decorationId').populate('proposer', resultSet).populate('userId').exec((err, items) => { .populate('decorationId').populate('proposer', resultSet).populate('userId')
.exec((err, items) => {
if (err) { if (err) {
err.status = codes.servererror; err.status = codes.servererror;
return next(err); return next(err);
// with return before (or after) the next(err) we prevent that the code continues here after next(err) // with return before (or after) the next(err) we prevent that the code continues here
// has finished. this saves an extra else {..} // after next(err) has finished. this saves an extra else {..}
} }
let results = []; let results = [];
if (req.query.fractFilter) { if (req.query.fractFilter) {
@ -98,9 +93,7 @@ awarding.route('/')
}); });
}) })
.all( .all(routerHandling.httpMethodNotAllowed);
routerHandling.httpMethodNotAllowed
);
awarding.route('/:id') awarding.route('/:id')
@ -146,9 +139,7 @@ awarding.route('/:id')
}); });
}) })
.all( .all(routerHandling.httpMethodNotAllowed);
routerHandling.httpMethodNotAllowed
);
// this middleware function can be used, if you like or remove it // this middleware function can be used, if you like or remove it
// it looks for object(s) in res.locals.items and if they exist, they are send to the client as json // it looks for object(s) in res.locals.items and if they exist, they are send to the client as json

View File

@ -67,7 +67,8 @@ decoration.route('/')
} }
res.status(codes.created); res.status(codes.created);
res.locals.items = decoration; res.locals.items = decoration;
fs.appendFile(__dirname + '/../resource/decoration/' + decoration.id + '.png', new Buffer(req.file.buffer), fs.appendFile(__dirname + '/../resource/decoration/' + decoration.id + '.png',
new Buffer(req.file.buffer),
(err) => { (err) => {
if (err) next(err); if (err) next(err);
}); });

View File

@ -42,7 +42,8 @@ campaignPlayer.route('/ranking/:campaignId')
new Set(items.map(usesUUID ? (x) => x.steamUUID : (x) => x.name)) new Set(items.map(usesUUID ? (x) => x.steamUUID : (x) => x.name))
.forEach((player) => { .forEach((player) => {
const playerInstances = items.filter(usesUUID ? (p) => p.steamUUID === player : (p) => p.name === player); const playerInstances = items.filter(
usesUUID ? (p) => p.steamUUID === player : (p) => p.name === player);
const resItem = { const resItem = {
name: usesUUID ? playerInstances[playerInstances.length - 1].name : player, name: usesUUID ? playerInstances[playerInstances.length - 1].name : player,
kill: 0, kill: 0,

View File

@ -206,8 +206,10 @@ const parseWarLog = (lineArray, war) => {
const playerName = stats.players[i].name; const playerName = stats.players[i].name;
stats.players[i]['respawn'] = stats.respawn.filter((res) => res.player === playerName).length; stats.players[i]['respawn'] = stats.respawn.filter((res) => res.player === playerName).length;
stats.players[i]['kill'] = stats.kills.filter((kill) => kill.shooter === playerName && !kill.friendlyFire).length; stats.players[i]['kill'] = stats.kills.filter((kill) => kill.shooter === playerName && !kill.friendlyFire).length;
stats.players[i]['vehicle'] = stats.vehicles.filter((vehicle) => vehicle.shooter === playerName && vehicleBlacklist.indexOf(vehicle.target) < 0).length; stats.players[i]['vehicle'] = stats.vehicles.filter(
stats.players[i]['friendlyFire'] = stats.kills.filter((kill) => kill.shooter === playerName && kill.friendlyFire).length; (vehicle) => vehicle.shooter === playerName && vehicleBlacklist.indexOf(vehicle.target) < 0).length;
stats.players[i]['friendlyFire'] = stats.kills.filter(
(kill) => kill.shooter === playerName && kill.friendlyFire).length;
stats.players[i]['death'] = stats.kills.filter((kill) => kill.target === playerName).length; stats.players[i]['death'] = stats.kills.filter((kill) => kill.target === playerName).length;
stats.players[i]['revive'] = stats.revive.filter((rev) => rev.medic === playerName && !rev.stabilized).length; stats.players[i]['revive'] = stats.revive.filter((rev) => rev.medic === playerName && !rev.stabilized).length;
stats.players[i]['flagTouch'] = stats.flag.filter((flag) => flag.player === playerName).length; stats.players[i]['flagTouch'] = stats.flag.filter((flag) => flag.player === playerName).length;

View File

@ -179,7 +179,8 @@ let addDecorationsAndSave = (userId, loadedImage, res, next) => {
// use synchronized call to keep correct order of decorations // use synchronized call to keep correct order of decorations
async.eachSeries(awardings, (award, callback) => { async.eachSeries(awardings, (award, callback) => {
jimp.read(resourceDir + 'decoration/' + award.decorationId._id + fileExt).then((decorationImage) => { jimp.read(resourceDir + 'decoration/' + award.decorationId._id + fileExt)
.then((decorationImage) => {
if (award.decorationId.isMedal) { if (award.decorationId.isMedal) {
decorationImage.resize(medalW, medalH); decorationImage.resize(medalW, medalH);
loadedImage.composite(decorationImage, medalPx, medalPy); loadedImage.composite(decorationImage, medalPx, medalPy);