Пример #1
0
def seeIfTourneyCanStart_Swiss(tourney_id, tourney_clotconfig):
	"""this is the special swiss version of the function"""
	
	ppp = players.Player.all().filter("tourney_id =", tourney_id)#.run(batch_size=1000)
	count = 0
	for p in ppp:
		if p.isParticipating:
			count += 1
	
	if count >= main.getMinimumNumberOfPlayers(tourney_id, tourney_clotconfig):
		if (not main.isTourneyInPlay(tourney_id, tourney_clotconfig)) and (not main.hasTourneyFinished(tourney_id, tourney_clotconfig)):
			if main.areWePastStarttime(tourney_id, tourney_clotconfig):
				main.startTourney(tourney_id, tourney_clotconfig)
				logging.info('tourney starting')
				return True
	else:
		logging.info('tourney doesnt yet have enough players to start.  num active players = '+str(count)+' num needed players = '+str(main.getMinimumNumberOfPlayers(tourney_id, tourney_clotconfig)))
		return False
Пример #2
0
def seeIfTourneyCanStart(tourney_id):
	"""this is the default function, if no special one is specified for the tourney type chosen"""
	
	ppp = players.Player.all().filter("tourney_id =", tourney_id)
	count = 0
	for p in ppp:
		if p.isParticipating:
			count += 1
	
	if count >= main.getMinimumNumberOfPlayers(tourney_id):
		if (not main.isTourneyInPlay(tourney_id)) and (not main.hasTourneyFinished(tourney_id)):
			if main.areWePastStarttime(tourney_id):
				main.startTourney(tourney_id)
				logging.info('tourney starting')
				return True
	else:
		logging.info('tourney doesnt yet have enough players to start.  num active players = '+str(count)+' num needed players = '+str(main.getMinimumNumberOfPlayers(tourney_id)))
		return False