I am working on a web interface that would allow the user to keep track of the amount of time people spend at their establishment.
The problem:
I don't know what the best way to keep track of this time would be. I have come up with a couple ideas on how this could be accomplished, but none of them are as elegant as I would like them to be.
I could:
- Store clocks in a MySQL database and calculate hours when requested.
- Store clocks and hours which would be calculated every time they clock out.
Why these solutions aren't good enough:
- Calculating the hours per request would rely heavily on a person clocking in and out in sequence in order to get this done elegantly. This would offer no flexibility when it comes to people forgetting to clock out. Maybe improper clock order could be flagged as a discrepancy and it won't calculate hours until it is resolved? It also seems like the query to get sequential clock ins/outs and determine the difference between them would be cumbersome.
- Calculating hours every time a person clocks out seems a little more reasonable, but then you would have to account for people forgetting to clock out. If someone forgets to clock out for a month, they would come back with a bunch of hours and the user would have inaccurate records.
I ask because I may be looking at this problem too closely and am failing to see an obvious solution. Any suggestions?