Skip to content

Commit

Permalink
feat: add time_in_draft to json output
Browse files Browse the repository at this point in the history
Signed-off-by: Zack Koppert <[email protected]>
  • Loading branch information
zkoppert committed Oct 23, 2024
1 parent edfb56e commit fe2bc4a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions json_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def write_to_json(
"time_to_first_response": "3 days, 0:00:00",
"time_to_close": "6 days, 0:00:00",
"time_to_answer": "None",
"time_in_draft": "1 day, 0:00:00",
"label_metrics": {
"bug": "1 day, 16:24:12"
}
Expand Down Expand Up @@ -152,6 +153,7 @@ def write_to_json(
"time_to_first_response": str(issue.time_to_first_response),
"time_to_close": str(issue.time_to_close),
"time_to_answer": str(issue.time_to_answer),
"time_in_draft": str(issue.time_in_draft),
"label_metrics": formatted_label_metrics,
}
)
Expand Down
5 changes: 5 additions & 0 deletions test_json_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def test_write_to_json(self):
time_to_first_response=timedelta(days=3),
time_to_close=timedelta(days=6),
time_to_answer=None,
time_in_draft=timedelta(days=1),
labels_metrics={
"bug": timedelta(days=1, hours=16, minutes=24, seconds=12)
},
Expand Down Expand Up @@ -88,6 +89,7 @@ def test_write_to_json(self):
"time_to_first_response": "3 days, 0:00:00",
"time_to_close": "6 days, 0:00:00",
"time_to_answer": "None",
"time_in_draft": "1 day, 0:00:00",
"label_metrics": {"bug": "1 day, 16:24:12"},
},
{
Expand All @@ -97,6 +99,7 @@ def test_write_to_json(self):
"time_to_first_response": "2 days, 0:00:00",
"time_to_close": "4 days, 0:00:00",
"time_to_answer": "1 day, 0:00:00",
"time_in_draft": "None",
"label_metrics": {},
},
],
Expand Down Expand Up @@ -180,6 +183,7 @@ def test_write_to_json_with_no_response(self):
"time_to_first_response": "None",
"time_to_close": "None",
"time_to_answer": "None",
"time_in_draft": "None",
"label_metrics": {},
},
{
Expand All @@ -189,6 +193,7 @@ def test_write_to_json_with_no_response(self):
"time_to_first_response": "None",
"time_to_close": "None",
"time_to_answer": "None",
"time_in_draft": "None",
"label_metrics": {},
},
],
Expand Down
3 changes: 2 additions & 1 deletion time_in_draft.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def measure_time_in_draft(
args:
issue (github3.issues.Issue): A GitHub issue which has been pre-qualified as a pull request.
ready_for_review_at (datetime | None): The time the pull request was marked as ready for review.
ready_for_review_at (datetime | None): The time the pull request was marked as
ready for review.
returns:
Union[datetime, None]: The time the pull request was in draft state.
Expand Down

0 comments on commit fe2bc4a

Please sign in to comment.