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: Fix summary peer reviews count #6855

Merged
merged 2 commits into from
Aug 8, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
public class ExternalIdentifiersSummary {
private String id;
private String url;
private boolean validatedOrSelfAsserted;
private boolean validated;

public String getId() {
return id;
Expand All @@ -29,12 +29,12 @@ public void setUrl(String url) {
this.url = url;
}

public boolean isValidatedOrSelfAsserted() {
return validatedOrSelfAsserted;
public boolean isValidated() {
return validated;
}

public void setValidatedOrSelfAsserted(boolean validatedOrSelfAsserted) {
this.validatedOrSelfAsserted = validatedOrSelfAsserted;
public void setValidated(boolean validated) {
this.validated = validated;
}

public static List<ExternalIdentifiersSummary> valueOf(PersonExternalIdentifiers personExternalIdentifiers, String orcid) {
Expand All @@ -60,7 +60,7 @@ public static ExternalIdentifiersSummary valueOf(PersonExternalIdentifier person
}

if (personExternalIdentifier.getSource() != null) {
form.setValidatedOrSelfAsserted(SourceUtils.isSelfAsserted(personExternalIdentifier.getSource(), orcid));
form.setValidated(SourceUtils.isSelfAsserted(personExternalIdentifier.getSource(), orcid));
}
}
return form;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,14 +460,14 @@ RecordSummary getSummary(String orcid) {

List<PeerReviewMinimizedSummary> peerReviewMinimizedSummaryList = peerReviewManagerReadOnly.getPeerReviewMinimizedSummaryList(orcid, true);

AtomicInteger publicationGrants = new AtomicInteger();
AtomicInteger totalReviewsCount = new AtomicInteger();

if (peerReviewMinimizedSummaryList != null) {
peerReviewMinimizedSummaryList.forEach(peerReviewMinimizedSummary -> {
publicationGrants.set(publicationGrants.intValue() + peerReviewMinimizedSummary.getPutCodes().size());
totalReviewsCount.set(totalReviewsCount.intValue() + peerReviewMinimizedSummary.getPutCodes().size());
});
recordSummary.setPeerReviewsTotal(peerReviewMinimizedSummaryList.size());
recordSummary.setPeerReviewPublicationGrants(publicationGrants.intValue());
recordSummary.setPeerReviewsTotal(totalReviewsCount.intValue());
recordSummary.setPeerReviewPublicationGrants(peerReviewMinimizedSummaryList.size());
} else {
recordSummary.setPeerReviewsTotal(0);
recordSummary.setPeerReviewPublicationGrants(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,15 @@ public void testGetRecordSummary() {
// Added by member
assertEquals(String.valueOf(19), record.getExternalIdentifiers().get(0).getId());
assertEquals("http://ext-id/self/obo/public", record.getExternalIdentifiers().get(0).getUrl());
assertFalse(record.getExternalIdentifiers().get(0).isValidatedOrSelfAsserted());
assertFalse(record.getExternalIdentifiers().get(0).isValidated());
// Added by user
assertEquals(String.valueOf(18), record.getExternalIdentifiers().get(1).getId());
assertEquals("http://ext-id/self/public", record.getExternalIdentifiers().get(1).getUrl());
assertFalse(record.getExternalIdentifiers().get(1).isValidatedOrSelfAsserted());
assertFalse(record.getExternalIdentifiers().get(1).isValidated());
// User OBO
assertEquals(String.valueOf(13), record.getExternalIdentifiers().get(2).getId());
assertEquals("http://ext-id/public_ref", record.getExternalIdentifiers().get(2).getUrl());
assertTrue(record.getExternalIdentifiers().get(2).isValidatedOrSelfAsserted());
assertTrue(record.getExternalIdentifiers().get(2).isValidated());

assertEquals(1, record.getValidatedWorks());
assertEquals(0, record.getSelfAssertedWorks());
Expand Down