mirror of
				https://github.com/simon987/od-database.git
				synced 2025-10-30 21:36:52 +00:00 
			
		
		
		
	Nicer stats
This commit is contained in:
		
							parent
							
								
									e89eb6e3e0
								
							
						
					
					
						commit
						3335ec5f82
					
				
							
								
								
									
										13
									
								
								app.py
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								app.py
									
									
									
									
									
								
							| @ -61,6 +61,19 @@ def datetime_format(value, format='%Y-%m-%d %H:%M:%S'): | ||||
|     return time.strftime(format, time.gmtime(value)) | ||||
| 
 | ||||
| 
 | ||||
| @app.template.filetr("duration_format") | ||||
| def duration_format(value): | ||||
|     delay = datetime.timedelta(seconds=value) | ||||
|     if (delay.days > 0): | ||||
|         out = str(delay).replace(" days, ", ":") | ||||
|     else: | ||||
|         out = "0:" + str(delay) | ||||
|     outAr = out.split(':') | ||||
|     outAr = ["%02d" % (int(float(x))) for x in outAr] | ||||
|     out   = ":".join(outAr) | ||||
|     return out | ||||
| 
 | ||||
| 
 | ||||
| @app.template_filter("from_timestamp") | ||||
| def from_timestamp(value): | ||||
|     return datetime.datetime.fromtimestamp(value) | ||||
|  | ||||
| @ -19,6 +19,9 @@ a { | ||||
| .table td { | ||||
|     padding: 2px 0; | ||||
| } | ||||
| .table-numeric td { | ||||
|     text-align: end; | ||||
| } | ||||
| 
 | ||||
| .bg-application { | ||||
|     background: #8FB847; | ||||
|  | ||||
| @ -71,7 +71,7 @@ | ||||
|                 </table> | ||||
| 
 | ||||
|                 <h4>Crawl server stats</h4> | ||||
|                 <table class="table table-striped"> | ||||
|                 <table class="table table-striped table-numeric"> | ||||
|                     <thead> | ||||
|                     <tr> | ||||
|                         <th>Server</th> | ||||
| @ -87,10 +87,10 @@ | ||||
|                         <tr> | ||||
|                             <td><b>{{ server }}</b></td> | ||||
|                             <td>{{ crawl_server_stats[server].task_count }}</td> | ||||
|                             <td>{{ crawl_server_stats[server].time|round(2) }}s</td> | ||||
|                             <td>{{ crawl_server_stats[server].time_avg|round(2) }}s</td> | ||||
|                             <td>{{ crawl_server_stats[server].time | duration_format() }}</td> | ||||
|                             <td>{{ crawl_server_stats[server].time_avg | duration_format() }}</td> | ||||
|                             <td>{{ crawl_server_stats[server].file_count }}</td> | ||||
|                             <td>{{ crawl_server_stats[server].file_count_avg | round(2) }}</td> | ||||
|                             <td>{{ "%.2f" % crawl_server_stats[server].file_count_avg }}</td> | ||||
|                         </tr> | ||||
|                     {% endfor %} | ||||
|                     </tbody> | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user