Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
style: Changes requested by review
  • Loading branch information
cxcarvaj committed Feb 16, 2022
commit bbf68f268363d4d87a9f6fc8dc0854b292df2ff9
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const doClockOut = async (context) => {
await Promise.all(
entries.map(async (timeEntryAsJson) => {
const timeEntry = new TimeEntry(timeEntryAsJson);
const { userName, userEmail } = findUserData( users, timeEntry.timeEntry.owner_id);
const { userName, userEmail } = findUserData(users, timeEntry.timeEntry.owner_id);
const userId = findSlackUserId(slackUsers, userEmail);

if (timeEntry.needsToBeClockedOut()) {
Expand All @@ -38,10 +38,11 @@ const doClockOut = async (context) => {
timeEntryAsJson.end_date = timeEntry.getTimeToClockOut();
await container.item(timeEntryAsJson.id, timeEntryAsJson.tenant_id).replace(timeEntryAsJson);
totalClockOutsExecuted++;

} else if (timeEntry.needsToBeClockedOutMidnight()) {
}

else if (timeEntry.needsToBeClockedOutMidnight()) {
if (userId) {
SlackClient.sendMessageToUser(userId,CLOCK_OUT_MESSAGE_MIDNIGHT.replace('%user_name%', userName));
SlackClient.sendMessageToUser(userId, CLOCK_OUT_MESSAGE_MIDNIGHT.replace('%user_name%', userName));
}
timeEntryAsJson.end_date = timeEntry.getTimeToClockOutMidnight();
await container.item(timeEntryAsJson.id, timeEntryAsJson.tenant_id).replace(timeEntryAsJson);
Expand Down