Skip to content

Commit

Permalink
Merge pull request #74 from vnma0/72-hotfix-2
Browse files Browse the repository at this point in the history
resolve #72 once again
  • Loading branch information
dungwinux authored Apr 4, 2019
2 parents 0ddd5bc + 9e9b581 commit c0573ea
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 c0573ea

Please sign in to comment.