Fix transitions between FAILURE and WARNING when using option Hysteresis in Thresholds

The old code would never emit a notification when the value changed between the `WARNING` and `FAILURE`; the reason was that each branch in the switch statement only checked the "old" thresholds valid for the previously encountered state. That is wrong and pretty dangerous, as there will be no notification when a values progresses slowly from `OK` to `WARN` to `FAIL`.

Fixes #578.