Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/analytics/analytics.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ export class AnalyticsService {
const successRate = totalRuns > 0 ? (successCount / totalRuns) * 100 : 0;
const sourcePublicationRate =
sourceDiscovered > 0 ? (sourcePublished / sourceDiscovered) * 100 : 0;
const hasMeaningfulFailureHistory = failedRuns >= 2;

let riskLevel = "STABLE";

Expand All @@ -229,7 +230,7 @@ export class AnalyticsService {
} else if (
lastRun.status === SourceRunStatus.PARTIAL ||
(hoursSinceLastRun !== null && hoursSinceLastRun >= 24) ||
failedRuns > 0 ||
hasMeaningfulFailureHistory ||
successRate < 80
) {
riskLevel = "WATCH";
Expand Down
5 changes: 4 additions & 1 deletion src/scraper-admin/scraper-admin.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ export class ScraperAdminService {
) {
attentionReason = lastRun.errorMessage || "Последний запуск завершился с ошибкой";
} else if ((health?.riskLevel ?? "STABLE") !== "STABLE") {
attentionReason = "Источник отмечен как требующий внимания";
attentionReason =
(health?.failedRuns ?? 0) > 0
? `${health?.failedRuns ?? 0} неуспешных или частичных запусков в недавнем окне при текущем успешном прогоне`
: "Источник отмечен как требующий внимания";
}

return {
Expand Down
Loading