Skip to content

Commit fe2bc4a

Browse files
committed
feat: add time_in_draft to json output
Signed-off-by: Zack Koppert <[email protected]>
1 parent edfb56e commit fe2bc4a

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

json_writer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def write_to_json(
5555
"time_to_first_response": "3 days, 0:00:00",
5656
"time_to_close": "6 days, 0:00:00",
5757
"time_to_answer": "None",
58+
"time_in_draft": "1 day, 0:00:00",
5859
"label_metrics": {
5960
"bug": "1 day, 16:24:12"
6061
}
@@ -152,6 +153,7 @@ def write_to_json(
152153
"time_to_first_response": str(issue.time_to_first_response),
153154
"time_to_close": str(issue.time_to_close),
154155
"time_to_answer": str(issue.time_to_answer),
156+
"time_in_draft": str(issue.time_in_draft),
155157
"label_metrics": formatted_label_metrics,
156158
}
157159
)

test_json_writer.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def test_write_to_json(self):
2424
time_to_first_response=timedelta(days=3),
2525
time_to_close=timedelta(days=6),
2626
time_to_answer=None,
27+
time_in_draft=timedelta(days=1),
2728
labels_metrics={
2829
"bug": timedelta(days=1, hours=16, minutes=24, seconds=12)
2930
},
@@ -88,6 +89,7 @@ def test_write_to_json(self):
8889
"time_to_first_response": "3 days, 0:00:00",
8990
"time_to_close": "6 days, 0:00:00",
9091
"time_to_answer": "None",
92+
"time_in_draft": "1 day, 0:00:00",
9193
"label_metrics": {"bug": "1 day, 16:24:12"},
9294
},
9395
{
@@ -97,6 +99,7 @@ def test_write_to_json(self):
9799
"time_to_first_response": "2 days, 0:00:00",
98100
"time_to_close": "4 days, 0:00:00",
99101
"time_to_answer": "1 day, 0:00:00",
102+
"time_in_draft": "None",
100103
"label_metrics": {},
101104
},
102105
],
@@ -180,6 +183,7 @@ def test_write_to_json_with_no_response(self):
180183
"time_to_first_response": "None",
181184
"time_to_close": "None",
182185
"time_to_answer": "None",
186+
"time_in_draft": "None",
183187
"label_metrics": {},
184188
},
185189
{
@@ -189,6 +193,7 @@ def test_write_to_json_with_no_response(self):
189193
"time_to_first_response": "None",
190194
"time_to_close": "None",
191195
"time_to_answer": "None",
196+
"time_in_draft": "None",
192197
"label_metrics": {},
193198
},
194199
],

time_in_draft.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ def measure_time_in_draft(
1717
1818
args:
1919
issue (github3.issues.Issue): A GitHub issue which has been pre-qualified as a pull request.
20-
ready_for_review_at (datetime | None): The time the pull request was marked as ready for review.
20+
ready_for_review_at (datetime | None): The time the pull request was marked as
21+
ready for review.
2122
2223
returns:
2324
Union[datetime, None]: The time the pull request was in draft state.

0 commit comments

Comments
 (0)