From 38744c81c5494c9f71abacaf2d43484cee428640 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Thu, 23 Jun 2016 17:08:11 -0400 Subject: [PATCH] Change future entries in heat map to be empty --- endpoints/api/repository.py | 2 +- static/css/directives/ui/heatmap.css | 6 ++++++ static/js/directives/ui/heatmap.js | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/endpoints/api/repository.py b/endpoints/api/repository.py index b974a1fcd..5ba6c39db 100644 --- a/endpoints/api/repository.py +++ b/endpoints/api/repository.py @@ -284,7 +284,7 @@ class Repository(RepositoryParamResource): found_dates['%s/%s' % (count.date.month, count.date.day)] = True # Fill in any missing stats with zeros. - for day in range(-31, MAX_DAYS_IN_3_MONTHS): + for day in range(1, MAX_DAYS_IN_3_MONTHS): day_date = datetime.now() - timedelta(days=day) key = '%s/%s' % (day_date.month, day_date.day) if not key in found_dates: diff --git a/static/css/directives/ui/heatmap.css b/static/css/directives/ui/heatmap.css index 9295c2805..129848ea7 100644 --- a/static/css/directives/ui/heatmap.css +++ b/static/css/directives/ui/heatmap.css @@ -15,3 +15,9 @@ font-size: 12px; text-transform: uppercase; } + +.heatmap-element .cal-heatmap-container svg .highlight { + fill: white; + stroke: #eee; + stroke-dasharray: 2; +} \ No newline at end of file diff --git a/static/js/directives/ui/heatmap.js b/static/js/directives/ui/heatmap.js index 0939a590f..2c42111e0 100644 --- a/static/js/directives/ui/heatmap.js +++ b/static/js/directives/ui/heatmap.js @@ -26,6 +26,11 @@ angular.module('quay').directive('heatmap', function () { if (!cal) { var start = moment().add($scope.startCount * 1, $scope.startDomain).toDate(); + var highlight = []; + for (i = 0; i < 31; ++i) { + var d = moment().add('day', i).toDate(); + highlight.push(d); + } cal = new CalHeatMap(); cal.init({ @@ -40,6 +45,7 @@ angular.module('quay').directive('heatmap', function () { displayLegend: false, tooltip: true, weekStartOnMonday: false, + highlight: highlight, legendColors: { empty: "#f4f4f4", min: "#c9e9fb",