sijis/whiskerboard — pull request #4 by jvasallo (2013-07-21 20:16:17+00:00)
Title: Fixed Overall Reporting

I recently fixed an issue, which was reported by a user, about false reporting of events. For example. If there was an issue that occurred on any day in the past five days, it would automatically display as OK, which is not always the case.

I added a model function to get the last_known_event. This function checks to see if there is a event posted for the current day, if so it just returns the last posted event (by id). If there is no event, however, it will check the previous day from the date passed. This last piece is recursive, meaning it will check each previous day from a previous day until it matches a last known event. To prevent a issue with recursive depth, I have added the case that if the amount of times the function is called is greater than 31 (31 days), determine that everything is running as intended.

As we intend our users to have a check at least once a month, I am not expecting the last piece to be an issue, especially since they will create an "OK" event. Otherwise, this application can get really bogged down with performance issues.