Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Required Contributors field, include YES in contact extraction #1483

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/src/components/collections/collections.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,12 @@ export function CollectionForm (props){
//Logic Flipped here to handle check for presence of object details not lack of
// Only include if presnent, ignore if not
console.debug('%c⊙', 'color:#00ff7b', "contributors",contributors );
if (contributors && (contributors[0] && contributors[0].orcid!==undefined)) {
if (!contributors || contributors.length === 0) {
setFormErrors((prevValues) => ({
...prevValues,
'contributors': "",
}))
}else if (contributors && (contributors[0] && contributors[0].orcid!==undefined)) {
// formValuesSubmit.contributors = contributors
formValuesSubmit.contributors = contributors
setFormErrors((prevValues) => ({
Expand Down Expand Up @@ -516,7 +521,7 @@ export function CollectionForm (props){
var contacts = []
for (const row of data.data) {
contributors.push(row)
if(row.is_contact === "TRUE"){
if(row.is_contact === "TRUE" || row.is_contact === "YES"){
contacts.push(row)
}
}
Expand Down
9 changes: 7 additions & 2 deletions src/src/components/collections/epicollections.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,12 @@ export function EPICollectionForm (props){
//Logic Flipped here to handle check for presence of object details not lack of
// Only include if presnent, ignore if not
console.debug('%c⊙', 'color:#00ff7b', "contributors",contributors );
if (contributors && (contributors[0] && contributors[0].orcid!==undefined)) {
if (!contributors || contributors.length === 0) {
setFormErrors((prevValues) => ({
...prevValues,
'contributors': "",
}))
}else if (contributors && (contributors[0] && contributors[0].orcid!==undefined)) {
// formValuesSubmit.contributors = contributors
formValuesSubmit.contributors = contributors
setFormErrors((prevValues) => ({
Expand Down Expand Up @@ -523,7 +528,7 @@ export function EPICollectionForm (props){
var contacts = []
for (const row of data.data) {
contributors.push(row)
if(row.is_contact === "TRUE"){
if(row.is_contact === "TRUE" || row.is_contact === "YES"){
contacts.push(row)
console.debug('%c◉ contact ', 'color:#00ff7b', row);
}
Expand Down
Loading