mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-28 13:31:06 +00:00
Fix some logic errors with captains
This commit is contained in:
parent
e9398fad87
commit
09669fb7c7
2 changed files with 4 additions and 3 deletions
|
@ -131,7 +131,7 @@ class Gather < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_status
|
def check_status
|
||||||
if status_changed? and status == STATE_PICKING and !self.captain1
|
if status_changed? and status == STATE_PICKING
|
||||||
g = Gather.new
|
g = Gather.new
|
||||||
g.category = self.category
|
g.category = self.category
|
||||||
g.save
|
g.save
|
||||||
|
@ -148,7 +148,7 @@ class Gather < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_captains
|
def check_captains
|
||||||
if status == STATE_RUNNING and is_ready? or admin
|
if status == STATE_RUNNING or status == STATE_VOTING and is_ready? or admin
|
||||||
self.turn = 1
|
self.turn = 1
|
||||||
self.status = STATE_PICKING
|
self.status = STATE_PICKING
|
||||||
gatherers.each do |gatherer|
|
gatherers.each do |gatherer|
|
||||||
|
|
|
@ -161,7 +161,8 @@ class Gatherer < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return false unless team.nil? \
|
return false unless team.nil? \
|
||||||
and ((gather.captain1.user == cuser and gather.turn == 1) or (gather.captain2.user == cuser and gather.turn == 2))
|
and ((gather.captain1 != nil and gather.captain1.user == cuser and gather.turn == 1) \
|
||||||
|
or (gather.captain2 != nil and gather.captain2.user == cuser and gather.turn == 2))
|
||||||
return false if gather.turn == 1 and gather.gatherers.team(1).count == 2 and gather.gatherers.team(2).count < 3
|
return false if gather.turn == 1 and gather.gatherers.team(1).count == 2 and gather.gatherers.team(2).count < 3
|
||||||
return false if gather.turn == 2 and gather.gatherers.team(1).count < 4 and gather.gatherers.team(2).count == 3
|
return false if gather.turn == 2 and gather.gatherers.team(1).count < 4 and gather.gatherers.team(2).count == 3
|
||||||
return false if gather.turn == 1 and gather.gatherers.team(1).count == 4 and gather.gatherers.team(2).count < 5
|
return false if gather.turn == 1 and gather.gatherers.team(1).count == 4 and gather.gatherers.team(2).count < 5
|
||||||
|
|
Loading…
Reference in a new issue