Skip to content

Commit

Permalink
fix: Update isSelfAsserted method in funding and fix NPE in peer review
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielPalafox committed Oct 3, 2023
1 parent a65a1fc commit 17ea543
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ public List<PeerReviewMinimizedSummary> getPeerReviewMinimizedSummaryList(String
BigInteger putCode = (BigInteger) q1[2];
String visibility = q1[3].toString();
String groupName = q1[4].toString();
String sourceId = q1[5].toString();
String clientSourceId = q1[6].toString();
String assertionOriginSourceId = q1[7].toString();
String sourceId = q1[5] != null ? q1[5].toString() : null;
String clientSourceId = q1[6] != null ? q1[6].toString() : null;
String assertionOriginSourceId = q1[7] != null ? q1[7].toString() : null;
if (peerReviewMinimizedSummaryList.size() > 0) {
List<PeerReviewMinimizedSummary> peerReviews = peerReviewMinimizedSummaryList
.stream()
Expand Down Expand Up @@ -230,4 +230,4 @@ public Boolean hasPublicPeerReviews(String orcid) {
return peerReviewDao.hasPublicPeerReviews(orcid);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.orcid.jaxb.model.v3.release.record.summary.WorkSummary;
import org.orcid.jaxb.model.v3.release.record.summary.Works;
import org.orcid.pojo.ajaxForm.AffiliationForm;
import org.orcid.pojo.ajaxForm.FundingForm;
import org.orcid.pojo.ajaxForm.PojoUtil;

import java.util.List;
Expand Down Expand Up @@ -323,7 +324,7 @@ public static boolean isSelfAsserted(AffiliationForm af, String orcid) {
return (orcid.equals(af.getSource()) || orcid.equals(af.getAssertionOriginOrcid()));
}

public static boolean isSelfAsserted(String source, String orcid) {
return !orcid.equals(source);
public static boolean isSelfAsserted(FundingForm ff, String orcid) {
return (orcid.equals(ff.getSource()) || orcid.equals(ff.getAssertionOriginOrcid()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,6 @@ public Comparator<FundingGroup> getInstance(String key, boolean sortAsc, String
public Comparator<FundingGroup> SOURCE_COMPARATOR = (g1, g2) -> Boolean.compare(isSelfAsserted(g1), isSelfAsserted(g2));

private boolean isSelfAsserted(FundingGroup fundingGroup) {
return SourceUtils.isSelfAsserted(fundingGroup.getSource(), orcid);
return SourceUtils.isSelfAsserted(fundingGroup.getDefaultFunding(), orcid);
}
}

0 comments on commit 17ea543

Please sign in to comment.