An unusual thing about the Bible is that is tells the whole story. Normally in ancient writings, only the good parts of the hero’s story are told. Especially when the hero is a king who could have his opponents killed. David not only does something wrong, he makes it worse by covering it up.
David went from patience and obedience to adultery and murder. None of us is immune to sin. We can never assume we have arrived in a safe place and stop depending on God.