mirror of
				https://github.com/StefBuwalda/dashboard_test.git
				synced 2025-10-30 03:09:59 +00:00 
			
		
		
		
	gets all logs from past hour rather than past 300 logs
This commit is contained in:
		| @@ -46,14 +46,15 @@ def homepage(): | |||||||
|  |  | ||||||
| @bp.route("/chart/<int:id>") | @bp.route("/chart/<int:id>") | ||||||
| def chart(id: int): | def chart(id: int): | ||||||
|  |     one_hour_ago = datetime.now(timezone.utc) - timedelta(hours=1) | ||||||
|     with app.app_context(): |     with app.app_context(): | ||||||
|         logs = [] |         logs = [] | ||||||
|         s = db.session.query(service).filter_by(id=id).first() |         s = db.session.query(service).filter_by(id=id).first() | ||||||
|         if s: |         if s: | ||||||
|             logs = cast( |             logs = cast( | ||||||
|                 list[log], |                 list[log], | ||||||
|                 s.logs.order_by(log.dateCreated.desc())  # type: ignore |                 s.logs.filter(log.dateCreated >= one_hour_ago) | ||||||
|                 .limit(300) |                 .order_by(log.dateCreated.desc())  # type: ignore | ||||||
|                 .all(), |                 .all(), | ||||||
|             ) |             ) | ||||||
|         else: |         else: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user