Skip to content

Commit

Permalink
Use publisher_id as part of created_by field
Browse files Browse the repository at this point in the history
This is so every report generated by da can be distinguished.
  • Loading branch information
richardhallett committed Dec 4, 2023
1 parent 448dd29 commit c9748cd
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions internal/app/reports/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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,
Expand Down

0 comments on commit c9748cd

Please sign in to comment.