Fixed a bug
This commit is contained in:
@@ -436,6 +436,12 @@ const ladderRequest = (connection) => (req, res) => {
|
|||||||
getBadgesStatistics((err, { statistics }) => {
|
getBadgesStatistics((err, { statistics }) => {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
|
|
||||||
|
//BUGFIX
|
||||||
|
if (results.length === 0) {
|
||||||
|
res.status(200).json([]);
|
||||||
|
res.end();
|
||||||
|
}
|
||||||
|
|
||||||
for(let i = 0; i < results.length; i++) {
|
for(let i = 0; i < results.length; i++) {
|
||||||
getBadgesOwned(connection, results[i].id, (err, { owned }) => {
|
getBadgesOwned(connection, results[i].id, (err, { owned }) => {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
@@ -449,6 +455,7 @@ const ladderRequest = (connection) => (req, res) => {
|
|||||||
//weird, because of async
|
//weird, because of async
|
||||||
if (i + 1 === results.length) {
|
if (i + 1 === results.length) {
|
||||||
res.status(200).json(results);
|
res.status(200).json(results);
|
||||||
|
res.end();
|
||||||
log('Ladder sent', req.body.start, req.body.length, results);
|
log('Ladder sent', req.body.start, req.body.length, results);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class BadgeText extends React.Component {
|
|||||||
render() {
|
render() {
|
||||||
if (!this.props.filename) {
|
if (!this.props.filename) {
|
||||||
return (
|
return (
|
||||||
<p {...this.props}>{this.props.children}</p>
|
<p className={this.props.className} style={this.props.style}>{this.props.children}</p>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user