Enhance dashboard summary and statistics with new fields and caching improvements
continuous-integration/drone/push Build is passing

- Added new field `Days` and `ScrapedTED` to `SummaryResponse` for tracking daily TED scrape counts.
- Updated `SummaryQuery` to include `Days` parameter for querying scraped TED data.
- Modified `Summary` handler to accept and process the new `Days` parameter.
- Refactored `Summary` method in the repository to support the new `Days` parameter and improved aggregation logic.
- Enhanced caching logic in the service layer to utilize a composite cache key based on `closingWindowSec` and `days`, improving cache management and retrieval efficiency.

This update improves the dashboard's functionality by providing more detailed insights into TED scraping activities and optimizing the caching strategy for better performance.
This commit is contained in:
Mazyar
2026-07-01 23:03:23 +03:30
parent eeafe2a625
commit 541d08a014
6 changed files with 347 additions and 119 deletions
+12 -11
View File
@@ -2,15 +2,17 @@ package dashboard
// SummaryResponse powers hero pills and stat cards.
type SummaryResponse struct {
TotalTenders int64 `json:"total_tenders"`
ActiveTenders int64 `json:"active_tenders"`
AwardedTenders int64 `json:"awarded_tenders"`
ExpiredTenders int64 `json:"expired_tenders"`
CancelledTenders int64 `json:"cancelled_tenders"`
ClosingSoon int64 `json:"closing_soon"`
TotalEstimatedValue float64 `json:"total_estimated_value"`
ValueCurrency string `json:"value_currency"`
GeneratedAt int64 `json:"generated_at"`
TotalTenders int64 `json:"total_tenders"`
ActiveTenders int64 `json:"active_tenders"`
AwardedTenders int64 `json:"awarded_tenders"`
ExpiredTenders int64 `json:"expired_tenders"`
CancelledTenders int64 `json:"cancelled_tenders"`
ClosingSoon int64 `json:"closing_soon"`
TotalEstimatedValue float64 `json:"total_estimated_value"`
ValueCurrency string `json:"value_currency"`
Days int `json:"days"`
ScrapedTED []TrendPoint `json:"scraped_ted"`
GeneratedAt int64 `json:"generated_at"`
}
// TrendResponse powers the tender flow chart.
@@ -96,8 +98,7 @@ type StatisticsReportResponse struct {
// StatisticsDailySeries contains per-day chart series.
type StatisticsDailySeries struct {
ScrapedTED []TrendPoint `json:"scraped_ted"`
ScrapedDocuments []TrendPoint `json:"scraped_documents"`
ScrapedDocuments []TrendPoint `json:"scraped_documents"`
TranslatedNotices []TrendPoint `json:"translated_notices"`
}