add diagnostic endpoint
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1546,8 +1546,12 @@ func UpdateSummaryPresenceByWindow(ctx context.Context, dbConn *sqlx.DB, summary
|
||||
query := fmt.Sprintf(`
|
||||
UPDATE %s
|
||||
SET "AvgIsPresent" = CASE
|
||||
WHEN %s > %s THEN (CAST((%s - %s) AS REAL) / ?)
|
||||
ELSE 0
|
||||
WHEN ("CreationTime" IS NOT NULL AND "CreationTime" > 0) OR ("DeletionTime" IS NOT NULL AND "DeletionTime" > 0) THEN
|
||||
CASE
|
||||
WHEN %s > %s THEN (CAST((%s - %s) AS REAL) / ?)
|
||||
ELSE 0
|
||||
END
|
||||
ELSE "AvgIsPresent"
|
||||
END
|
||||
`, summaryTable, endExpr, startExpr, endExpr, startExpr)
|
||||
query = dbConn.Rebind(query)
|
||||
@@ -1596,6 +1600,7 @@ UPDATE %s dst
|
||||
SET
|
||||
"CreationTime" = CASE
|
||||
WHEN t.any_creation IS NOT NULL AND t.any_creation > 0 THEN LEAST(COALESCE(NULLIF(dst."CreationTime", 0), t.any_creation), t.any_creation)
|
||||
WHEN (dst."CreationTime" IS NULL OR dst."CreationTime" = 0) AND t.first_seen IS NOT NULL AND t.first_seen > 0 THEN t.first_seen
|
||||
ELSE dst."CreationTime"
|
||||
END,
|
||||
"DeletionTime" = CASE
|
||||
@@ -1657,6 +1662,7 @@ SET
|
||||
(
|
||||
SELECT CASE
|
||||
WHEN t.any_creation IS NOT NULL AND t.any_creation > 0 AND COALESCE(NULLIF(%[2]s."CreationTime", 0), t.any_creation) > t.any_creation THEN t.any_creation
|
||||
WHEN (%[2]s."CreationTime" IS NULL OR %[2]s."CreationTime" = 0) AND t.first_seen IS NOT NULL AND t.first_seen > 0 THEN t.first_seen
|
||||
ELSE NULL
|
||||
END
|
||||
FROM enriched t
|
||||
|
||||
Reference in New Issue
Block a user