Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
apprentice1988 committed Oct 24, 2015
1 parent dbf19d9 commit f538f1e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def start
@project = Project.find(params[:id])
# @user = User.first
# @parti = Participation.find_or_initialize_by(project_id: @project.id, user_id: @user.id)
@parti = Participations.create(project_id: @project.id, status: 'doing')
@parti = Participation.create(project_id: @project.id, status: 'doing')
render json: { success: true }
end

Expand All @@ -31,6 +31,7 @@ def validate
# @user = User.first
if @project.puzzle.answer == params[:answer]
@parti = Participation.find_by(project_id: @project.id)
render json: {success: false } and return if @parti.blank?
@parti.update(status: 'finished')
render json: { success: true }
else
Expand Down

0 comments on commit f538f1e

Please sign in to comment.