ps-i2830-states-cache-fix
Fix states cache method of checking if state is fresh
When we get last build status for a repository or a branch we use the id column to determine which build is the last one. In states cache builds were checked based on the finished_at column, which may have cause cache to be out of sync.