|
@@ -2,7 +2,7 @@ import time
|
|
|
from datetime import datetime, timedelta
|
|
from datetime import datetime, timedelta
|
|
|
from typing import Optional, Dict, Any, Tuple
|
|
from typing import Optional, Dict, Any, Tuple
|
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
-from sqlalchemy import select, func, and_
|
|
|
|
|
|
|
+from sqlalchemy import select, func, and_, case
|
|
|
|
|
|
|
|
from app.models.proxy_reputation import ProxyReputation, ProxyTelemetryLog
|
|
from app.models.proxy_reputation import ProxyReputation, ProxyTelemetryLog
|
|
|
from app.schemas.proxy_reputation import (
|
|
from app.schemas.proxy_reputation import (
|
|
@@ -82,7 +82,7 @@ class ProxyReputationService:
|
|
|
select(
|
|
select(
|
|
|
func.count(ProxyTelemetryLog.id).label("total_cnt"),
|
|
func.count(ProxyTelemetryLog.id).label("total_cnt"),
|
|
|
func.sum(
|
|
func.sum(
|
|
|
- func.case((ProxyTelemetryLog.success.is_(False), 1), else_=0)
|
|
|
|
|
|
|
+ case((ProxyTelemetryLog.success.is_(False), 1), else_=0)
|
|
|
).label("fail_cnt"),
|
|
).label("fail_cnt"),
|
|
|
)
|
|
)
|
|
|
.where(
|
|
.where(
|