justicenation / slashclock

/clock concept as a new Slack app
GNU General Public License v3.0
0 stars 0 forks source link

Clock out yesterday #18

Closed martyychang closed 6 years ago

martyychang commented 6 years ago

As a user, I want to be able to clock out at a time in the previous day, so I can fix any problems with me having forgotten to clock out at the right time yesterday.

martyychang commented 6 years ago

To make this user-friendly (at least in English for me) I think the most natural UX would be to look for the keyword "yesterday" before the time.

Examples below show clocking in and out today.

/clock in 8:30am
/clock out 5:00pm

Examples below show clocking in and out yesterday.

/clock in yesterday 8:30am
/clock out yesterday 5:00pm

This design also preserves a more consistent option for accepting tags or other keywords to come after the time parameter.

martyychang commented 6 years ago

I was getting an "uncommitted work" error in my Apex test when trying to call SlashclockOutCommand.load to set up the given preconditions.

 METHOD RESULT 
clockOutFiveThirtyPm : Fail

 STACK TRACE 
Class.SlackApiService.usersInfo: line 99, column 1
Class.SlackService.getTimeZoneSidKey: line 83, column 1
Class.SlashclockOutCommand.load: line 52, column 1
Class.SlashclockOutCommandTest.clockOutFiveThirtyPm: line 53, column 1

 MESSAGE 
System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out

I was able to fix this by moving the load call to happen after Test.startTest()