Changeset - 8732ad224e56
[Not reviewed]
default
0 1 0
Laman - 7 years ago 2018-05-04 12:34:57

dotaz fetchByRating
1 file changed with 12 insertions and 0 deletions:
0 comments (0 inline, 0 general)
queries.py
Show inline comments
 
@@ -177,12 +177,24 @@ def tournamentAttendance(year1,year2):
 
	print("Návštěvnosti (počty hráčů) na turnajích podle let")
 
	print("kód země\t"+"\t".join(str(y) for y in range(year1,year2)))
 
	for country in sorted(res.keys()):
 
		print(country,end="\t")
 
		print("\t".join(str(res[country].get(y,0)) for y in range(year1,year2)))
 

	
 

	
 
def fetchByRating(strongerThan,country=""):
 
	"""Hráči, kteří dosáhli rating strongerThan nebo vyšší, nepovinně filtrovaní podle země, seřazení od nejlepšího dosaženého ratingu."""
 
	query="""select pin,name,max(rating_after) as max_rating from players_performance natural join players where rating_after>=? and (?='' or country_code=?) group by pin order by max_rating desc"""
 

	
 
	res=cursor.execute(query,(strongerThan,country,country))
 
	print("pin\tjméno\tmax rating")
 
	for rec in res:
 
		print("\t".join([str(x) for x in rec]))
 

	
 

	
 
# playerYear("Kotowski Jaroslav",2017)
 
# timeRank(2017,"CZ")
 
# yearsByCountry(2001,2018)
 
# populationStrength(2001,2018,"RU")
 
# populationAge(2001,2018,"RU")
 
# tournamentAttendance(2001,2018)
 
# fetchByRating(2600,"CZ")
0 comments (0 inline, 0 general)