Bitergia time to first review is a days value not seconds

I was terribly confused by the extremely small values I was getting out
of this. After eating lunch it occurred to me that these values could be
days not seconds then they would better align with the examples I was
cross checking against. Using the bitergia dashboard to compare values I
get the same 0.77 days for nova from 20250101 to 20250327 median value
for time to first review. I thought this was 0.77 seconds but the
dashboard showing days seems to confirm the unit is days.

Fix this in the script and make the output a bit more human readable.
0.77 days should be output as 18:28:48 for 18 hours 28 minutes and 48
seconds.

Change-Id: Ie584054dce4a46d1415f94055ac842b8fe3169f3
This commit is contained in:
Clark Boylan 2025-03-31 15:07:22 -07:00
parent 1fe88e81f0
commit 991941dec4

View File

@ -178,13 +178,9 @@ def calculate_median_time_to_review(client, project_name,
hits = r['hits']['hits']
while hits:
for hit in hits:
# This time_to_first_review value appears completely broken.
# It seems to treat the comment saying patchset 1 was pushed as
# the first review which happens immediately after the change
# is created.
# I have tried this querying patchset_time_to_first_review against
# patchsets and time_to_first_review against changesets and get
# similarly broken data.
# Note time_to_first_review appears to be storing a float count
# of the number of days to the first review. This is an odd
# way to store the value so I'm documenting it here.
time_to_first_review = hit["_source"]["time_to_first_review"]
if time_to_first_review:
# We can apparently get None values back. Ignore them.
@ -196,9 +192,8 @@ def calculate_median_time_to_review(client, project_name,
hits = r['hits']['hits']
times_sorted = sorted(times_to_review)
middle = math.floor(len(times_to_review) / 2)
median = times_sorted[middle]
average = sum(times_sorted) / len(times_sorted)
print("WARNING these values are invalid due to bad data in Bitergia.")
median = datetime.timedelta(days=times_sorted[middle])
average = datetime.timedelta(days=sum(times_sorted) / len(times_sorted))
print("%s median time to first review %s to %s: %sseconds" %
(project_name, start_date, end_date, median))
print("%s average time to first review %s to %s: %sseconds" %