1. Made changes to fix the bug NIHVIVO-2087. Incorrent count values were being displayed in cases of collaborators sparklines.

This commit is contained in:
cdtank 2011-02-09 22:29:34 +00:00
parent f62776d24f
commit f1e9475716
5 changed files with 51 additions and 5 deletions

View file

@ -125,7 +125,11 @@
} }
var totalPublicationCount = knownYearPublicationCounts + unknownYearPublicationCounts; if (${sparklineVO.totalCollaborationshipCount?c}) {
var totalPublicationCount = ${sparklineVO.totalCollaborationshipCount?c};
} else {
var totalPublicationCount = knownYearPublicationCounts + unknownYearPublicationCounts;
}
<#if sparklineVO.shortVisMode> <#if sparklineVO.shortVisMode>

View file

@ -125,7 +125,13 @@
} }
var totalGrantCount = knownYearGrantCounts + unknownYearGrantCounts; if (${sparklineVO.totalCollaborationshipCount?c}) {
var totalGrantCount = ${sparklineVO.totalCollaborationshipCount?c};
} else {
var totalGrantCount = knownYearGrantCounts + unknownYearGrantCounts;
}
<#if sparklineVO.shortVisMode> <#if sparklineVO.shortVisMode>

View file

@ -160,6 +160,14 @@ public class CoAuthorshipVisCodeGenerator {
sparklineData.setYearToEntityCountDataTable(yearToUniqueCoauthorsCountDataTable); sparklineData.setYearToEntityCountDataTable(yearToUniqueCoauthorsCountDataTable);
/*
* This is required only for the sparklines which convey collaborationships like coinvestigatorships
* and coauthorship. There are edge cases where a collaborator can be present for in a collaboration
* with known & unknown year. We do not want to repeat the count for this collaborator when we present
* it in the front-end.
* */
Set<Node> totalUniqueCoInvestigators = new HashSet<Node>(allCoAuthorsWithKnownAuthorshipYears);
/* /*
* Total publications will also consider publications that have no year associated with * Total publications will also consider publications that have no year associated with
* them. Hence. * them. Hence.
@ -168,10 +176,14 @@ public class CoAuthorshipVisCodeGenerator {
if (yearToUniqueCoauthors.get(VOConstants.DEFAULT_PUBLICATION_YEAR) != null) { if (yearToUniqueCoauthors.get(VOConstants.DEFAULT_PUBLICATION_YEAR) != null) {
unknownYearCoauthors = yearToUniqueCoauthors unknownYearCoauthors = yearToUniqueCoauthors
.get(VOConstants.DEFAULT_PUBLICATION_YEAR).size(); .get(VOConstants.DEFAULT_PUBLICATION_YEAR).size();
totalUniqueCoInvestigators.addAll(yearToUniqueCoauthors.get(VOConstants.DEFAULT_GRANT_YEAR));
} }
sparklineData.setUnknownYearPublications(unknownYearCoauthors); sparklineData.setUnknownYearPublications(unknownYearCoauthors);
sparklineData.setTotalCollaborationshipCount(totalUniqueCoInvestigators.size());
if (providedVisContainerID != null) { if (providedVisContainerID != null) {
visContainerID = providedVisContainerID; visContainerID = providedVisContainerID;
} else { } else {

View file

@ -166,10 +166,18 @@ public class CoPIVisCodeGenerator {
* rendered in full mode will always be the one's which have any year * rendered in full mode will always be the one's which have any year
* associated with it. Hence. * associated with it. Hence.
*/ */
sparklineData.setRenderedSparks(renderedFullSparks); sparklineData.setRenderedSparks(allCoPIsWithKnownGrantShipYears.size());
sparklineData.setYearToEntityCountDataTable(yearToUniqueInvestigatorsCountDataTable); sparklineData.setYearToEntityCountDataTable(yearToUniqueInvestigatorsCountDataTable);
/*
* This is required only for the sparklines which convey collaborationships like coinvestigatorships
* and coauthorship. There are edge cases where a collaborator can be present for in a collaboration
* with known & unknown year. We do not want to repeat the count for this collaborator when we present
* it in the front-end.
* */
Set<CoPINode> totalUniqueCoInvestigators = new HashSet<CoPINode>(allCoPIsWithKnownGrantShipYears);
/* /*
* Total grants will also consider grants that have no year * Total grants will also consider grants that have no year
* associated with them. Hence. * associated with them. Hence.
@ -178,8 +186,13 @@ public class CoPIVisCodeGenerator {
if (yearToUniqueCoPIs.get(VOConstants.DEFAULT_GRANT_YEAR) != null) { if (yearToUniqueCoPIs.get(VOConstants.DEFAULT_GRANT_YEAR) != null) {
unknownYearGrants = yearToUniqueCoPIs.get( unknownYearGrants = yearToUniqueCoPIs.get(
VOConstants.DEFAULT_GRANT_YEAR).size(); VOConstants.DEFAULT_GRANT_YEAR).size();
totalUniqueCoInvestigators.addAll(yearToUniqueCoPIs.get(VOConstants.DEFAULT_GRANT_YEAR));
} }
sparklineData.setTotalCollaborationshipCount(totalUniqueCoInvestigators.size());
sparklineData.setUnknownYearGrants(unknownYearGrants); sparklineData.setUnknownYearGrants(unknownYearGrants);
if (providedVisContainerID != null) { if (providedVisContainerID != null) {

View file

@ -17,6 +17,8 @@ public class SparklineData {
private Integer unknownYearPublications; private Integer unknownYearPublications;
private Integer unknownYearGrants; private Integer unknownYearGrants;
private Integer totalCollaborationshipCount;
private Map<String, Integer> yearToActivityCount; private Map<String, Integer> yearToActivityCount;
private String downloadDataLink = ""; private String downloadDataLink = "";
@ -30,6 +32,15 @@ public class SparklineData {
private int numOfYearsToBeRendered; private int numOfYearsToBeRendered;
public void setTotalCollaborationshipCount(
Integer totalCollaborationshipCount) {
this.totalCollaborationshipCount = totalCollaborationshipCount;
}
public Integer getTotalCollaborationshipCount() {
return totalCollaborationshipCount;
}
public Integer getEarliestRenderedGrantYear() { public Integer getEarliestRenderedGrantYear() {
return earliestRenderedGrantYear; return earliestRenderedGrantYear;
} }