Skip to content

Commit

Permalink
revert: "fix: check if lunch date is this week"
Browse files Browse the repository at this point in the history
This reverts commit 24b85d8.
Why this broke things is unknown. Reopen #2
  • Loading branch information
Adam Simpson committed Apr 8, 2016
1 parent 24b85d8 commit dc48c7e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 30 deletions.
25 changes: 10 additions & 15 deletions src/generalAnnouncement.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,16 @@ const getData = () => {
const parseData = (data) => {
const dates = getDateColumn(data);
const next = getNextLunch(dates);
const today = new Date();
//1000 * 3600 * 24 is milliseconds in 1 day
const dayInMilliseconds = 1000 * 3600 * 24;
if ((next - today) / (dayInMilliseconds) < 7) {
const names = parseNames(data, next);
const slackNames = returnSlackNames(names, namesObj);
const formattedNames = formatSlackNames(slackNames).toString();
const msg = `
<@dayton> ${formattedNames} are scheduled to help with lunch on Friday.
${process.env.sheetUrl}
`;

postToSlack('#general', msg);
}
const names = parseNames(data, next);
const slackNames = returnSlackNames(names, namesObj);
const formattedNames = formatSlackNames(slackNames).toString();
const msg = `
<@dayton> ${formattedNames} are scheduled to help with lunch on Friday.
${process.env.sheetUrl}
`;

postToSlack('#general', msg);
};

const formatSlackNames = (names) => {
Expand Down
25 changes: 10 additions & 15 deletions src/privateReminder.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,17 @@ const getData = () => {
const parseData = (data) => {
const dates = getDateColumn(data);
const next = getNextLunch(dates);
const today = new Date();
//1000 * 3600 * 24 is milliseconds in 1 day
const dayInMilliseconds = 1000 * 3600 * 24;
if ((next - today) / (dayInMilliseconds) < 7) {
const names = parseNames(data, next);
const slackNames = returnSlackNames(names, namesObj);
const msg = `
You are scheduled to help with lunch on Friday with ${names}.\n If you are unable to do so please find a replacement and update the spreadsheet.
const names = parseNames(data, next);
const slackNames = returnSlackNames(names, namesObj);
const msg = `
You are scheduled to help with lunch on Friday with ${names}.\n If you are unable to do so please find a replacement and update the spreadsheet.
${process.env.sheetUrl}
`;

${process.env.sheetUrl}
`;

slackNames.forEach((helper) => {
postToSlack(`@${helper}`, msg);
});
}
slackNames.forEach((helper) => {
postToSlack(`@${helper}`, msg);
});
};

const date = new Date();
Expand Down

0 comments on commit dc48c7e

Please sign in to comment.