Skip to content

Commit f5bda66

Browse files
authored
Merge pull request #97 from id/fix-time-to-first-response
fix: fix time to first response
2 parents c3d29d0 + 3d63f98 commit f5bda66

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

test_time_to_first_response.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,14 @@ def test_measure_time_to_first_response(self):
3333
"""
3434
# Set up the mock GitHub issues
3535
mock_issue1 = MagicMock()
36-
mock_issue1.comments = 1
36+
mock_issue1.comments = 2
3737
mock_issue1.created_at = "2023-01-01T00:00:00Z"
3838

3939
mock_comment1 = MagicMock()
4040
mock_comment1.created_at = datetime.fromisoformat("2023-01-02T00:00:00Z")
41-
mock_issue1.issue.comments.return_value = [mock_comment1]
41+
mock_comment2 = MagicMock()
42+
mock_comment2.created_at = datetime.fromisoformat("2023-01-02T12:00:00Z")
43+
mock_issue1.issue.comments.return_value = [mock_comment1, mock_comment2]
4244

4345
# Call the function
4446
result = measure_time_to_first_response(mock_issue1, None)
@@ -105,7 +107,9 @@ def test_measure_time_to_first_response_only_ignored_users(self):
105107
mock_issue1.issue.comments.return_value = [mock_comment1, mock_comment2]
106108

107109
# Call the function
108-
result = measure_time_to_first_response(mock_issue1, None, ["ignored_user", "ignored_user2"])
110+
result = measure_time_to_first_response(
111+
mock_issue1, None, ["ignored_user", "ignored_user2"]
112+
)
109113
expected_result = None
110114

111115
# Check the results

time_to_first_response.py

+2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def measure_time_to_first_response(
5656
if comment.user.login in ignore_users:
5757
continue
5858
first_comment_time = comment.created_at
59+
break
5960

6061
# Check if the issue is actually a pull request
6162
# so we may also get the first review comment time
@@ -66,6 +67,7 @@ def measure_time_to_first_response(
6667
if review_comment.user.login in ignore_users:
6768
continue
6869
first_review_comment_time = review_comment.submitted_at
70+
break
6971

7072
# Figure out the earliest response timestamp
7173
if first_comment_time and first_review_comment_time:

0 commit comments

Comments
 (0)