Skip to content

Fix: Infinity Bug in Commit Statistics

What does this MR do?

It fixes a logic bug in the commits statistics: The code assumed that the amount of days involved in a commit range is equal to the difference between the first and last date. This is not true, though, as (from a human standpoint), a commit yesterday and a commit today involve two days, not one. Similarly, a fresh project with only commits made today already 'used' one day.

Since the number of involved days used to be zero for new projects, the result for commits per day quite often amounted to Infinity

Are there points in the code the reviewer needs to double check?

The test file. I hope it is up to the standards of GitLab.

Why was this MR needed?

The bug occurres especially for new users with their first project while exploring GitLab.

What are the relevant issue numbers?

This bug was reported as #1548 (closed).

Screenshots (if relevant)

Merge request reports