| 
									
										
										
										
											2022-10-17 01:08:31 +02:00
										 |  |  | from datetime import timedelta, datetime | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-04 23:50:18 +02:00
										 |  |  | from flask import render_template | 
					
						
							| 
									
										
										
										
											2022-10-17 01:08:31 +02:00
										 |  |  | from pony.orm import count | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-11 16:59:37 +02:00
										 |  |  | from WebHostLib import app, cache | 
					
						
							| 
									
										
										
										
											2022-10-17 01:08:31 +02:00
										 |  |  | from .models import Room, Seed | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-04 23:50:18 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | @app.route('/', methods=['GET', 'POST']) | 
					
						
							| 
									
										
										
										
											2020-08-13 09:23:52 +02:00
										 |  |  | @cache.cached(timeout=300)  # cache has to appear under app route for caching to work | 
					
						
							| 
									
										
										
										
											2020-07-04 23:50:18 +02:00
										 |  |  | def landing(): | 
					
						
							| 
									
										
										
										
											2020-08-13 09:23:52 +02:00
										 |  |  |     rooms = count(room for room in Room if room.creation_time >= datetime.utcnow() - timedelta(days=7)) | 
					
						
							|  |  |  |     seeds = count(seed for seed in Seed if seed.creation_time >= datetime.utcnow() - timedelta(days=7)) | 
					
						
							|  |  |  |     return render_template("landing.html", rooms=rooms, seeds=seeds) |