Skip to content

Commit

Permalink
bug:unresolved issue #64
Browse files Browse the repository at this point in the history
  • Loading branch information
rsdoiel committed Mar 4, 2023
1 parent 382d7e4 commit 5ab434f
Showing 3 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
"codeRepository": "https://github.com/caltechlibrary/eprinttools",
"issueTracker": "https://github.com/caltechlibrary/eprinttools/issues",
"license": "https://caltechlibrary.github.io/eprinttools/license.html",
"version": "1.2.4",
"version": "1.2.5",
"author": [
{
"@type": "Person",
23 changes: 18 additions & 5 deletions crosswalk.go
Original file line number Diff line number Diff line change
@@ -126,6 +126,9 @@ func simplifyContributors(rec *Record) error {
}
}
}
if contributor.PersonOrOrg.Role == nil {
return fmt.Errorf("contributor is missing role -> %+v", contributor)
}
contributors = append(contributors, contributor)
}
}
@@ -309,10 +312,17 @@ func creatorFromItem(item *Item, objType string, objRoleSrc string, objIdType st
identifier.Identifier = item.ID
person.Identifiers = append(person.Identifiers, identifier)
}
//NOTE: for contributors we need to map the type as LOC URI
// to a person's role.
if item.Type != "" {
person.Role = &Role{ ID: item.Type }
if objRoleSrc == "contributor" {
//NOTE: for contributors we need to map the type as LOC URI
// to a person's role.
if item.Type != "" {
person.Role = &Role{ ID: item.Type }
}
// DEBUG start
if person.Role == nil {
fmt.Printf("DEBUG person.Role should have been populated -> %+v\nDEBUG item passed -> %+v\n", person.Role, item)
}
// DEBUG end
}
creator := new(Creator)
creator.PersonOrOrg = person
@@ -379,8 +389,11 @@ func metadataFromEPrint(eprint *EPrint, rec *Record) error {
}
}
if (eprint.Contributors != nil) && (eprint.Contributors.Items != nil) {
for _, item := range eprint.Contributors.Items {
fmt.Printf("DEBUG eprint.Contributors.Items -> %+v\n", eprint.Contributors.Items)
for i, item := range eprint.Contributors.Items {
fmt.Printf("DEBUG eprint.Contributors.Items[%d] -> %+v\n", i, item)
contributor := creatorFromItem(item, "personal", "contributor", "contributor_id")

metadata.Contributors = append(metadata.Contributors, contributor)
}
}
2 changes: 1 addition & 1 deletion ep3sql.go
Original file line number Diff line number Diff line change
@@ -1611,7 +1611,7 @@ func eprintIDToPersonItemList(db *sql.DB, tables map[string][]string, repoID str
}
tablesAndColumn := map[string][2]string{}
columnPrefix := strings.TrimPrefix(tablePrefix, `eprint_`)
for _, suffix := range []string{"id", "orcid", "uri", "url", "role", "email", "show_email"} {
for _, suffix := range []string{"id", "orcid", "uri", "url", "role", "email", "show_email", "type"} {
key := fmt.Sprintf("%s_%s", tablePrefix, suffix)
tablesAndColumn[key] = [2]string{
// Column Name

0 comments on commit 5ab434f

Please sign in to comment.