From 72b69ebf718c5c6ea2e67dfc42cca0db88f9e9ef Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Wed, 20 Mar 2013 17:04:42 +0100 Subject: [PATCH] Fixed month selection. --- src/static/js/months.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/static/js/months.js b/src/static/js/months.js index d655062..5066d20 100644 --- a/src/static/js/months.js +++ b/src/static/js/months.js @@ -60,14 +60,14 @@ var MonthController = function($scope, $http, $rootScope) { angular.forEach($scope.months, function(month) { // Reset selected month to the new instance corresponding to the old one if($scope.month) { - if(month == $scope.month) { - monthToSelect = month; - } - } else { - if(month.year === currentYear && month.month === currentMonth) { + if(month.year == $scope.month.year && month.month == $scope.month.month) { monthToSelect = month; } } + + if(!monthToSelect && month.year == currentYear && month.month == currentMonth) { + monthToSelect = month; + } }); // Set selected month to the last one if not yet selected.