Changeset - 02615be35737
[Not reviewed]
default
0 1 0
Laman - 7 years ago 2018-06-08 00:39:01

dotaz lifeSpans
1 file changed with 13 insertions and 0 deletions:
0 comments (0 inline, 0 general)
queries.py
Show inline comments
 
@@ -273,15 +273,28 @@ def playersProgress():
 

	
 
	print("pin\tkód země\tpočet turnajů\t"+"\t".join(str(y) for y in range(y1,y2)))
 
	for (pin,p) in players.items():
 
		print(pin,p.country,p.tournamentCount,*(p.rating.get(y,0) for y in range(y1,y2)),sep="\t")
 

	
 

	
 
def lifeSpans():
 
	"""Životnosti hráčů. Datum prvního a posledního turnaje, jejich rozdíl v letech, počet odehraných turnajů."""
 
	query="""select pin,min(datum) as min_datum,max(datum) as max_datum,(julianday(max(datum))-julianday(min(datum)))/365.25 as lifespan,count(datum) as t_count
 
		from players_performance_tournaments group by pin"""
 

	
 
	res=cursor.execute(query)
 

	
 
	print("pin\tmin datum\tmax datum\tmax-min\tpočet turnajů")
 
	for rec in res:
 
		print("\t".join([str(x) for x in rec]))
 

	
 

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