mirror of
https://github.com/bellingcat/auto-archiver-api.git
synced 2026-06-11 21:18:35 +03:00
update time metrics
This commit is contained in:
@@ -71,8 +71,8 @@ def count_archives(db:Session):
|
||||
def count_archive_urls(db:Session):
|
||||
return db.query(func.count(models.ArchiveUrl.url)).scalar()
|
||||
|
||||
def count_by_user_since(db:Session, time_delta: timedelta = timedelta(seconds=30)):
|
||||
time_threshold = datetime.now() - time_delta
|
||||
def count_by_user_since(db:Session, seconds_delta: int = 15):
|
||||
time_threshold = datetime.now() - timedelta(seconds=seconds_delta)
|
||||
return db.query(models.Archive.author_id,func.count().label('total'))\
|
||||
.filter(models.Archive.created_at >= time_threshold)\
|
||||
.group_by(models.Archive.author_id)\
|
||||
|
||||
Reference in New Issue
Block a user