Refactor solution to check submissions state

Add test to make sure that the solution changes a submissions state when the
necessary conditions are met. Add test to make sure solution does not change a
submissions state when the conditions are not met.
Refactor solution to check a submissions state as opposed to check if its the
last submission.