Implement test and fix for that case #201

Add test_should_account_for_zero_paddded_keys plus its corresponding fix
for it.
This commit is contained in:
Rafa de la Torre
2016-06-13 13:07:21 +02:00
parent a2863d7135
commit b0bb60736c
2 changed files with 9 additions and 1 deletions

View File

@@ -85,6 +85,11 @@ class UserMetricsService:
service, metric, date)
score = self._redis_connection.zscore(redis_prefix, date.day)
aggregated_metric += score if score else 0
zero_padded_day = date.strftime('%d')
if str(date.day) != zero_padded_day:
score = self._redis_connection.zscore(redis_prefix, zero_padded_day)
aggregated_metric += score if score else 0
return aggregated_metric
# Private functions