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
const resultSet = {
'__v': 0,
'updatedAt': 0,
'timestamp': 0,
'password': 0,
'permission': 0,
'secret': 0,
'activated': 0,
'__v': 0, 'updatedAt': 0, 'timestamp': 0, 'password': 0, 'permission': 0, 'secret': 0, 'activated': 0,
};
const awarding = express.Router();
@ -56,12 +50,13 @@ awarding.route('/')
});
} else {
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) {
err.status = codes.servererror;
return next(err);
// with return before (or after) the next(err) we prevent that the code continues here after next(err)
// has finished. this saves an extra else {..}
// with return before (or after) the next(err) we prevent that the code continues here
// after next(err) has finished. this saves an extra else {..}
}
let results = [];
if (req.query.fractFilter) {
@ -98,9 +93,7 @@ awarding.route('/')
});
})
.all(
routerHandling.httpMethodNotAllowed
);
.all(routerHandling.httpMethodNotAllowed);
awarding.route('/:id')
@ -146,9 +139,7 @@ awarding.route('/:id')
});
})
.all(
routerHandling.httpMethodNotAllowed
);
.all(routerHandling.httpMethodNotAllowed);
// 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

View File

@ -67,7 +67,8 @@ decoration.route('/')
}
res.status(codes.created);
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) => {
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))
.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 = {
name: usesUUID ? playerInstances[playerInstances.length - 1].name : player,
kill: 0,

View File

@ -206,8 +206,10 @@ const parseWarLog = (lineArray, war) => {
const playerName = stats.players[i].name;
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]['vehicle'] = stats.vehicles.filter((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]['vehicle'] = stats.vehicles.filter(
(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]['revive'] = stats.revive.filter((rev) => rev.medic === playerName && !rev.stabilized).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
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) {
decorationImage.resize(medalW, medalH);
loadedImage.composite(decorationImage, medalPx, medalPy);