From c9748cda5018672b70a26399c49ae9acd95d62a2 Mon Sep 17 00:00:00 2001 From: Richard Hallett Date: Mon, 4 Dec 2023 12:06:29 +0100 Subject: [PATCH] Use publisher_id as part of created_by field This is so every report generated by da can be distinguished. --- internal/app/reports/service.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/internal/app/reports/service.go b/internal/app/reports/service.go index 951f4f3..76f43b6 100644 --- a/internal/app/reports/service.go +++ b/internal/app/reports/service.go @@ -126,7 +126,7 @@ func (service *ReportsService) GenerateDatasetUsageReport(repoId string, startDa } // Generate report header - reportHeader := generateReportHeader(startDate, endDate, exceptions) + reportHeader := generateReportHeader(startDate, endDate, sharedData, exceptions) // Generate report report := CounterDatasetReport{ @@ -141,14 +141,18 @@ func (service *ReportsService) GenerateDatasetUsageReport(repoId string, startDa } // Generate report header -func generateReportHeader(beginDate time.Time, endDate time.Time, exceptions []Exception) ReportHeader { +func generateReportHeader(beginDate time.Time, endDate time.Time, sharedData SharedData, exceptions []Exception) ReportHeader { var reportHeader ReportHeader reportHeader.ReportName = "Dataset Master Report" reportHeader.Release = "rd1" reportHeader.ReportId = "dsr" reportHeader.Created = beginDate.Format(time.RFC3339) - reportHeader.CreatedBy = "datacite-analytics" + if sharedData.PublisherId != "" { + reportHeader.CreatedBy = "da_" + sharedData.PublisherId + } else { + reportHeader.CreatedBy = "datacite-analytics" + } reportHeader.ReportingPeriod = ReportingPeriod{ BeginDate: beginDate, EndDate: endDate,