mendicant-original / puzzlenode

Quiz application inspired by Project Euler and the Internet Problem Solving Contest (IPSC)
puzzlenode.com
81 stars 43 forks source link

Multiple submissions of correct solutions for users with draft access #31

Closed madebydna closed 13 years ago

madebydna commented 13 years ago

Users with draft access should be able to submit correct solutions multiple times. Right now, after submitting a correct solution the button for submitting one's solution is gone.

Enabling users with draft access to submit correct solutions multiple times would come in handy during the testing phase of a new puzzle. For example, if changes are made to the original input or solution file as a result of tester feedback.

jordanbyron commented 13 years ago

I think this is fairly simple to do. Just add that check to line 22 of submission.rb. Something like:

def only_one_correct_submission_per_puzzle_per_user
  if user && !user.draft_access && user.solution_for(puzzle)
    errors[:base] << "You've already solved this puzzle!"
    return false
  end
end
jordanbyron commented 13 years ago

Merged in Pull Request #31