From 2f1b57e9a952b7a709b872382217c41d8156bf24 Mon Sep 17 00:00:00 2001 From: Alex Bardanov Date: Sat, 19 Jul 2014 20:02:00 +0300 Subject: [PATCH] fix to undefined download counters --- extension/services/registry.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extension/services/registry.js b/extension/services/registry.js index d4ad06f..64b90c7 100644 --- a/extension/services/registry.js +++ b/extension/services/registry.js @@ -63,6 +63,8 @@ define(function(require, exports, module){ } else { var today = getDownloadsCounterByDate(extension.downloads), yesterday = getDownloadsCounterByDate(extension.downloads, today.timestamp); + if (yesterday && !yesterday.count){ yesterday.count = 0; } + extension.dailyDownloads = today && yesterday? today.count - yesterday.count : 0; } registry[extension._id] = extension;