Skip to content

Commit

Permalink
resolve #72 once again
Browse files Browse the repository at this point in the history
  • Loading branch information
dungwinux committed Apr 4, 2019
1 parent 0ddd5bc commit 9e9b581
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/data/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,13 @@ async function readAllSubmissions(page, size, count) {
if (err) reject(err);
else {
let usernameListPromise = docs.map((doc) =>
readUserByID(doc.user_id).catch(() => null)
readUserByID(doc.user_id)
.catch(() => ({ username: null }))
.then((x) => x.username)
);
Promise.all(usernameListPromise).then((usernameList) => {
let serialized = docs.map((doc, idx) => {
doc.username = usernameList[idx].username;
doc.username = usernameList[idx];
return doc;
});
resolve({
Expand Down

0 comments on commit 9e9b581

Please sign in to comment.