Open ruslan-korneev opened 1 year ago
project.issues.list()[0].notes.list()[3].asdict()
{
"id": 10005,
"type": null,
"body": "added 6h of time spent",
"attachment": null,
"author": {
"id": 48,
"username": "sahakyan",
"name": "Edita Sahakyan",
"state": "active",
"avatar_url": null,
"web_url": "https://gitlab.example.com/sahakyan"
},
"created_at": "2023-07-25T10:15:12.137+03:00",
"updated_at": "2023-07-25T10:15:12.140+03:00",
"system": true,
"noteable_id": 1459,
"noteable_type": "Issue",
"resolvable": false,
"confidential": false,
"noteable_iid": 5,
"commands_changes": {}
}
class
TimeTracker
methods to get list of spent time.
Solution
To specify users who spent time for some issue/merge-request, we could parse an
{ProjectIssue/ProjectMergeRequest}.notes
body, if body ends with "time spent" we could catch the time and translate from human-readable to seconds. Example, how to getProjectIssue
,ProjectMergeRequest
:To collect all spent time without information about user we could use just existing information from gitlab-api, issue and merge-request object has method
time_stats
, where we can get time in seconds.