From 07ac61b2f51cba5b79d17435475310a735bb96f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=B0=AC=ED=98=B8?= Date: Fri, 24 Sep 2021 13:48:16 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20commit=20=EC=88=98=EB=A1=9C=20?= =?UTF-8?q?=ED=95=84=ED=84=B0=EB=A7=81=EC=9D=B4=20=EB=90=98=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EB=8A=94=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/services/mail/mailAutoSender.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/backend/src/services/mail/mailAutoSender.js b/backend/src/services/mail/mailAutoSender.js index a537b02..985c702 100644 --- a/backend/src/services/mail/mailAutoSender.js +++ b/backend/src/services/mail/mailAutoSender.js @@ -1,6 +1,5 @@ const Team = require("../../models/team"); const User = require("../../models/user"); -const fetch = require('node-fetch'); const { getCommitCountOfTeam } = require("../github"); const nodemailer = require('nodemailer'); @@ -22,7 +21,7 @@ const getUsersCommits = async (teamIds) => { const commits = await getCommitCountOfTeam(teamIds[i]); users.concat(commits); } - return users; + return users.filter(el => parseInt(el.commit) === 0).map(el => el.userId); } catch(err){ console.error(err); @@ -34,7 +33,7 @@ const getUsersEmail = async (users) => { const userIds = []; for(let i = 0; i < users.length; i++){ - const user = User.find({githubId:`${users[i]}`}); + const user = await User.find({githubId:`${users[i]}`}); userIds.push(user.email); }; return userIds;