Skip to content

Commit

Permalink
Merge pull request #6855 from ORCID/8799-qasummary-page-rename-peer-r…
Browse files Browse the repository at this point in the history
…eview-variables

fix: Fix summary peer reviews count
  • Loading branch information
amontenegro authored Aug 8, 2023
2 parents 748932c + 0d18308 commit a73802d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
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

0 comments on commit a73802d

Please sign in to comment.