Skip to content

Commit

Permalink
fix: fix trailing empty contributor record
Browse files Browse the repository at this point in the history
  • Loading branch information
rsdoiel committed Mar 3, 2023
1 parent 55d8927 commit 683ed31
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions crosswalk.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,31 @@ func simplifyCreators(rec *Record) error {
return nil
}

// simplifyContributors make sure the identifiers are mapped to Invenio-RDM
// identifiers.
func simplifyContributors(rec *Record) error {
if rec.Metadata.Contributors != nil && len(rec.Metadata.Contributors) > 0 {
contributors := []*Creator{}
for _, contributor := range rec.Metadata.Contributors {
if contributor.PersonOrOrg != nil && contributor.PersonOrOrg.FamilyName != "" {
if contributor.PersonOrOrg.Identifiers != nil && len(contributor.PersonOrOrg.Identifiers) > 0 {
for _, identifier := range contributor.PersonOrOrg.Identifiers {
if identifier.Scheme == "contributor_id" {
identifier.Scheme = "clpid"
}
}
}
contributors = append(contributors, contributor)
}
}
if len(contributors) > 0 {
rec.Metadata.Contributors = contributors
}
}
return nil
}


func simplifyFunding(rec *Record) error {
if rec.Metadata.Funding != nil && len(rec.Metadata.Funding) > 0 {
for _, funder := range rec.Metadata.Funding {
Expand Down

0 comments on commit 683ed31

Please sign in to comment.