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:
@@ -389,3 +389,25 @@ func (t *TenderJSON) translationForLanguage(language string) (StoredTranslation,
|
||||
}
|
||||
return t.storedTranslationText(language)
|
||||
}
|
||||
|
||||
// hasAnyTranslation reports whether tender.json contains at least one non-empty
|
||||
// title translation (via translation_status.done or the translations map).
|
||||
func (t *TenderJSON) hasAnyTranslation() bool {
|
||||
if t == nil {
|
||||
return false
|
||||
}
|
||||
for _, lang := range t.translationsDone() {
|
||||
if _, ok := t.storedTranslationText(lang); ok {
|
||||
return true
|
||||
}
|
||||
}
|
||||
if t.Translations == nil {
|
||||
return false
|
||||
}
|
||||
for _, entry := range t.Translations {
|
||||
if strings.TrimSpace(entry.Title) != "" {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user