When you turn in a second attempt on an assignment, you do not replace the original assignment that you submitted. Instead, that assignment and grade remains. When you turn in your new (or revised) assignment file, Moodle creates a second record for the assignment. Because of this, in certain places you will actually see that you turned in two separate assignments and most likely received two separate grades for the assignment. Usually the grade given for your second attempt is the one that will be recorded in the gradebook as your final grade for the assignment.