Add translated notices scanning functionality to dashboard repository
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
- Introduced a new `translatedNoticesScanner` interface for scanning MinIO for daily translated notice counts. - Enhanced the `repository` struct to include fields for managing translated notice scope and caching. - Implemented the `ScanTranslatedNotices` method in the `StorageClient` to retrieve daily counts and total from MinIO. - Updated the `Statistics` method in the repository to utilize the new translated notices scope, improving data accuracy. - Added unit tests for the translated notices functionality, ensuring robust validation of the new features. This update significantly enhances the dashboard's ability to handle translated notice statistics, improving overall data management and reporting capabilities.
This commit is contained in:
@@ -27,6 +27,11 @@ type scrapedDocumentsScanner interface {
|
||||
ScanScrapedDocuments(ctx context.Context) ([]ai_summarizer.ProcedureDocumentsSummary, map[string]int64, error)
|
||||
}
|
||||
|
||||
// translatedNoticesScanner optionally scans MinIO for per-day translated notice counts.
|
||||
type translatedNoticesScanner interface {
|
||||
ScanTranslatedNotices(ctx context.Context) (map[string]int64, int64, error)
|
||||
}
|
||||
|
||||
const defaultValueCurrency = "EUR"
|
||||
|
||||
// Repository defines dashboard data access.
|
||||
@@ -51,6 +56,11 @@ type repository struct {
|
||||
scrapedScopeExpiry time.Time
|
||||
scrapedScopeCached bool
|
||||
scrapedScopeGroup singleflight.Group
|
||||
translatedScopeMu sync.Mutex
|
||||
translatedScope translatedNoticesScope
|
||||
translatedScopeExpiry time.Time
|
||||
translatedScopeCached bool
|
||||
translatedScopeGroup singleflight.Group
|
||||
}
|
||||
|
||||
// NewRepository creates a dashboard repository backed by the tenders collection.
|
||||
|
||||
Reference in New Issue
Block a user