From 665769d50588a655ad168942c55d2a559f05520c Mon Sep 17 00:00:00 2001 From: vrana Date: Tue, 26 Jun 2012 16:20:41 -0700 Subject: [PATCH] Use whole days in Differential stats Test Plan: /differential/stats/revisions/ Reviewers: vii, jungejason, epriestley Reviewed By: epriestley CC: aran, epriestley Differential Revision: https://secure.phabricator.com/D2867 --- .../differential/view/DifferentialRevisionStatsView.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/applications/differential/view/DifferentialRevisionStatsView.php b/src/applications/differential/view/DifferentialRevisionStatsView.php index e011433e79..66eb51aecf 100644 --- a/src/applications/differential/view/DifferentialRevisionStatsView.php +++ b/src/applications/differential/view/DifferentialRevisionStatsView.php @@ -90,7 +90,7 @@ final class DifferentialRevisionStatsView extends AphrontView { $revisions_seen[$rev_id] = true; foreach ($dates as $age => $cutoff) { - if ($cutoff > $rev_date) { + if ($cutoff >= $rev_date) { continue; } if ($rev) { @@ -105,10 +105,9 @@ final class DifferentialRevisionStatsView extends AphrontView { $old_count = 0; foreach (array_reverse($dates) as $age => $cutoff) { - $weeks = ($now - $cutoff + 0.) / (7 * 60 * 60 * 24); + $weeks = ceil(($now - $cutoff) / (60 * 60 * 24)) / 7; if ($old_count == $counts[$age] && count($row_array) == 1) { - end($row_array); - unset($dates[key($row_array)]); + unset($dates[last_key($row_array)]); $row_array = array(); } $old_count = $counts[$age];