Skip to content

Commit

Permalink
Adds fix for empty last edited date.
Browse files Browse the repository at this point in the history
  • Loading branch information
MShultz authored and rhansen committed Aug 17, 2020
1 parent 858cd42 commit 15750ad
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,22 @@ let pads = {
data.results.push(entrySet);
});

let getEdited = [];
if (data.results.length > 0) {
data.results.forEach(function (value) {
let resultObject = api.getLastEdited(value.padName);
value.lastEdited = resultObject.lastEdited;
resultObject = api.padUsersCount(value.padName);
value.userCount = resultObject.padUsersCount;
getEdited.push(
api.getLastEdited(value.padName)
.then((resultObject) => {
value.lastEdited = resultObject.lastEdited;
resultObject = api.padUsersCount(value.padName);
value.userCount = resultObject.padUsersCount;
}));
});
} else {
data.message = 'No results';
}

await Promise.all(getEdited);
return data;
},
};
Expand Down

0 comments on commit 15750ad

Please sign in to comment.