rodrodsalazar/Kong-Judge — Issue #29: The method that we create the submission doesn't seem correct.
Author: rodrodsalazar
Created: 2012-01-05 16:06:49+00:00
State: open

````
if current_user
@submission = @curr_problem.submissions.build(:code => params[:submission][:code], :user => current_user, \
:problem => @curr_problem, :result => -1)
@submission = current_user.submissions.build(:code => params[:submission][:code], :user => current_user, :\
problem => @curr_problem, :result => -1)
if @submission.save
@submission.async_send_submission(params[:submission][:code])
redirect_to (user_path(current_user))
else
````

This is a piece of code from the submission controller, we build 2 different `submission`objects ...

The worker inside of the background job does the following:

````
@curr_submission = Submission.find_by_id(curr_submission_id)
@curr_submission[:result] = result.first
@curr_submission.save
````

I feel like we might have 2 copies of the submission, one stored in the User and another stored with the problem...then when we try to update the result status when IDEONE responds, we only update one of them (which ever the find_by_id returns)

Not 100% this is happening, but my guess is that it definitely is.