From 58976b5d99aae4266edc8d48cfb022b4174ca213 Mon Sep 17 00:00:00 2001 From: cdtank Date: Thu, 14 Apr 2011 15:19:05 +0000 Subject: [PATCH] 1. Partial fix for NIHVIVO-2150. This will make sure that there is no downward curve for the sparklines for the current year. Only last 10 complete years are considered. e..g it is 15th april, 2011 today, sparkline will consider only publications that have dates before/on 31st december, 2010 --- .../coauthorship/CoAuthorshipVisCodeGenerator.java | 8 +++++++- .../coprincipalinvestigator/CoPIVisCodeGenerator.java | 8 +++++++- .../PersonGrantCountVisCodeGenerator.java | 8 +++++++- .../PersonPublicationCountVisCodeGenerator.java | 8 +++++++- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/coauthorship/CoAuthorshipVisCodeGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/coauthorship/CoAuthorshipVisCodeGenerator.java index d239824d..220cbfb9 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/coauthorship/CoAuthorshipVisCodeGenerator.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/coauthorship/CoAuthorshipVisCodeGenerator.java @@ -71,7 +71,13 @@ public class CoAuthorshipVisCodeGenerator { SparklineData sparklineData = new SparklineData(); int numOfYearsToBeRendered = 0; - int currentYear = Calendar.getInstance().get(Calendar.YEAR); + + /* + * It was decided that to prevent downward curve that happens if there are no publications + * in the current year seems a bit harsh, so we consider only publications from the last 10 + * complete years. + * */ + int currentYear = Calendar.getInstance().get(Calendar.YEAR) - 1; int shortSparkMinYear = currentYear - VisConstants.MINIMUM_YEARS_CONSIDERED_FOR_SPARKLINE + 1; diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/coprincipalinvestigator/CoPIVisCodeGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/coprincipalinvestigator/CoPIVisCodeGenerator.java index 50dddfb9..a3a3a51c 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/coprincipalinvestigator/CoPIVisCodeGenerator.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/coprincipalinvestigator/CoPIVisCodeGenerator.java @@ -78,7 +78,13 @@ public class CoPIVisCodeGenerator { SparklineData sparklineData = new SparklineData(); int numOfYearsToBeRendered = 0; - int currentYear = Calendar.getInstance().get(Calendar.YEAR); + + /* + * It was decided that to prevent downward curve that happens if there are no publications + * in the current year seems a bit harsh, so we consider only publications from the last 10 + * complete years. + * */ + int currentYear = Calendar.getInstance().get(Calendar.YEAR) - 1; int shortSparkMinYear = currentYear - VisConstants.MINIMUM_YEARS_CONSIDERED_FOR_SPARKLINE + 1; diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/persongrantcount/PersonGrantCountVisCodeGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/persongrantcount/PersonGrantCountVisCodeGenerator.java index a874655c..bc05ef0e 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/persongrantcount/PersonGrantCountVisCodeGenerator.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/persongrantcount/PersonGrantCountVisCodeGenerator.java @@ -72,7 +72,13 @@ public class PersonGrantCountVisCodeGenerator { sparklineData.setYearToActivityCount(yearToGrantCount); int numOfYearsToBeRendered = 0; - int currentYear = Calendar.getInstance().get(Calendar.YEAR); + + /* + * It was decided that to prevent downward curve that happens if there are no publications + * in the current year seems a bit harsh, so we consider only publications from the last 10 + * complete years. + * */ + int currentYear = Calendar.getInstance().get(Calendar.YEAR) - 1; int shortSparkMinYear = currentYear - VisConstants.MINIMUM_YEARS_CONSIDERED_FOR_SPARKLINE + 1; diff --git a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/personpubcount/PersonPublicationCountVisCodeGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/personpubcount/PersonPublicationCountVisCodeGenerator.java index 5d9f0c5f..760b16ed 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/personpubcount/PersonPublicationCountVisCodeGenerator.java +++ b/src/edu/cornell/mannlib/vitro/webapp/visualization/freemarker/personpubcount/PersonPublicationCountVisCodeGenerator.java @@ -74,7 +74,13 @@ public class PersonPublicationCountVisCodeGenerator { int numOfYearsToBeRendered = 0; - int currentYear = Calendar.getInstance().get(Calendar.YEAR); + + /* + * It was decided that to prevent downward curve that happens if there are no publications + * in the current year seems a bit harsh, so we consider only publications from the last 10 + * complete years. + * */ + int currentYear = Calendar.getInstance().get(Calendar.YEAR) - 1; int shortSparkMinYear = currentYear - VisConstants.MINIMUM_YEARS_CONSIDERED_FOR_SPARKLINE + 1;