|
|
|
@ -157,7 +157,7 @@ class ContestsController < ApplicationController
|
|
|
|
|
contests = Contest.where('parent_id = ?', @contest.id)
|
|
|
|
|
@softapplications = []
|
|
|
|
|
for contest in contests
|
|
|
|
|
@softapplications += contest.softapplications
|
|
|
|
|
@softapplications += contest.contesting_softapplications
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
@ -240,6 +240,7 @@ class ContestsController < ApplicationController
|
|
|
|
|
|
|
|
|
|
# @user = @contest.user
|
|
|
|
|
@softapplication = Softapplication.all
|
|
|
|
|
@contesting_softapplication = @contest.contesting_softapplications
|
|
|
|
|
|
|
|
|
|
# @temp = []
|
|
|
|
|
# @softapplicationt.each do |pro|
|
|
|
|
@ -292,15 +293,15 @@ class ContestsController < ApplicationController
|
|
|
|
|
def add_softapplication
|
|
|
|
|
softapplication = Softapplication.find(params[:contest])
|
|
|
|
|
contest_message = params[:contest_for_save][:contest_message]
|
|
|
|
|
if Softapplication.where("softapplication_id = ? and contest_id = ?", softapplication.id, @contest.id).size == 0
|
|
|
|
|
if Softapplication.create_contesting(@contest.id, softapplication.id, contest_message)
|
|
|
|
|
if ContestingSoftapplication.where("softapplication_id = ? and contest_id = ?", softapplication.id, @contest.id).size == 0
|
|
|
|
|
if ContestingSoftapplication.create_contesting(@contest.id, softapplication.id, contest_message)
|
|
|
|
|
flash.now[:notice] = l(:label_bidding_contest_succeed)
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
flash.now[:error] = l(:label_bidding_fail)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
@softapplication = @contest.softapplications
|
|
|
|
|
@contesting_softapplication = @contest.contesting_softapplications
|
|
|
|
|
|
|
|
|
|
render :text => params.to_json
|
|
|
|
|
# respond_to do |format|
|
|
|
|
|