Add integration tests for stats endpoints and fix JSON report serialization
This commit is contained in:
@@ -2904,7 +2904,7 @@ def generate_stats_report(
|
||||
"""Generate a summary report of storage and deduplication statistics."""
|
||||
# Gather stats
|
||||
total_artifacts = db.query(func.count(Artifact.id)).scalar() or 0
|
||||
total_size = db.query(func.coalesce(func.sum(Artifact.size), 0)).scalar() or 0
|
||||
total_size = int(db.query(func.coalesce(func.sum(Artifact.size), 0)).scalar() or 0)
|
||||
total_uploads = db.query(func.count(Upload.id)).scalar() or 0
|
||||
deduplicated_uploads = (
|
||||
db.query(func.count(Upload.id)).filter(Upload.deduplicated == True).scalar()
|
||||
@@ -2917,7 +2917,7 @@ def generate_stats_report(
|
||||
db.query(func.count(Artifact.id)).filter(Artifact.ref_count == 0).scalar() or 0
|
||||
)
|
||||
|
||||
storage_saved = (
|
||||
storage_saved = int(
|
||||
db.query(func.coalesce(func.sum(Artifact.size), 0))
|
||||
.join(Upload, Upload.artifact_id == Artifact.id)
|
||||
.filter(Upload.deduplicated == True)
|
||||
|
||||
Reference in New Issue
Block a user