From 5d877702e7d7571bfb7821abb4373cd56f2a1854 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Thu, 12 Feb 2015 02:14:57 +0000 Subject: [PATCH] added a fake data point when the number of data point is less than 2 in the project_home view --- codepot/src/codepot/views/project_home.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/codepot/src/codepot/views/project_home.php b/codepot/src/codepot/views/project_home.php index 54616e6f..0274feb7 100644 --- a/codepot/src/codepot/views/project_home.php +++ b/codepot/src/codepot/views/project_home.php @@ -82,6 +82,20 @@ function show_commits_per_month_graph(response) max_month = parseInt(max_date.substring (5), 10); // fill empty data points + if (min_year == max_year && min_month == max_month) + { + // only 1 data point if this condition is met + // insert a fake data point to make at least 2 data points + if (min_month <= 1) + { + min_year--; + min_month = 12; + } + else + { + min_month--; + } + } for (year = min_year; year <= max_year; year++) { month = (year == min_year)? min_month: 1;