dosubot[bot] commented on issue #8654: URL: https://github.com/apache/incubator-devlake/issues/8654#issuecomment-3602821535
<!-- Greeting --> Hi @fazizsoltani! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the incubator-devlake team. <!-- Answer --> You’re right—DevLake currently calculates deployment completion time using the deployment’s overall `UpdatedDate`, which often reflects the timestamp of the later 'inactive' status, not the actual 'success' status. This logic is in the conversion step ([deployment_convertor.go](https://github.com/apache/incubator-devlake/blob/2c15ad880dce830c6512fa58039527cbf4745b8b/backend/plugins/github_graphql/tasks/deployment_convertor.go#L50-L125)), where `FinishedDate` and `DurationSec` are set using `githubDeployment.UpdatedDate`, regardless of the deployment status. To fix this, update the conversion logic to select the timestamp of the final 'success' status from the deployment’s status history, rather than the latest update (which could be 'inactive'). You’ll likely need to adjust how statuses are extracted and stored so you can reliably access the correct 'success' timestamp during conversion. The relevant extraction logic is in [deployment_extractor.go](https://github.com/apache/incubator-devlake/blob/2c15ad880dce830c6512fa58039527cbf4745b8b/backend/plugins/github_graphql/tasks/deployment_extractor.go#L42-L102). This change will ensure PR Deploy Time metrics reflect the actual deployment completion, not when it was superseded. If you need help navigating the code or want to discuss implementation details, let me know! <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/66c132ae-7300-4cd3-9bce-c5f275dc68c2?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/66c132ae-7300-4cd3-9bce-c5f275dc68c2?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/66c132ae-7300-4cd3-9bce-c5f275dc68c2?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/66c132ae-7300-4cd3-9bce-c5f275dc68c2?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/66c132ae-7300-4cd3-9bce-c5f275dc68c2?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/66c132ae-7300-4cd3-9bce-c5f275dc68c2?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/66c132ae-7300-4cd3-9bce-c5f275dc68c2?feedback_type=other)</sup> [](https://app.dosu.dev/b4e8e847-d479-4541-83a8-d88d83fea5c9/ask?utm_source=github) [](https://cursor.com/link/prompt?text=You%E2%80%99re%20right%E2%80%94DevLake%20currently%20calculates%20deployment%20completion%20time%20using%20the%20deployment%E2%80%99s%20overall%20%60UpdatedDate%60%2C%20which%20often%20reflects%20the%20timestamp%20of%20the%20later%20%27inactive%27%20status%2C%20not%20the%20actual%20%27success%27%20status.%20This%20logic%20is%20in%20the%20conversion%20step%20%28%5Bdeployment_convertor.go%5D%28https%3A//github.com/apache/incubator-devlake/blob/2c15ad880dce830c6512fa58039527cbf4745b8b/backend/plugins/github_graphql/tasks/deployment_convertor.go%23L50-L125%29%29%2C%20where%20%60FinishedDate%60%20and%20%60DurationSec%60%20are%20set%20using%20%60githubDeployment.UpdatedDate%60%2C%20regardless%20of%20the%20deployment%20status.%0A%0ATo%20fix%20this%2C%20up date%20the%20conversion%20logic%20to%20select%20the%20timestamp%20of%20the%20final%20%27success%27%20status%20from%20the%20deployment%E2%80%99s%20status%20history%2C%20rather%20than%20the%20latest%20update%20%28which%20could%20be%20%27inactive%27%29.%20You%E2%80%99ll%20likely%20need%20to%20adjust%20how%20statuses%20are%20extracted%20and%20stored%20so%20you%20can%20reliably%20access%20the%20correct%20%27success%27%20timestamp%20during%20conversion.%20The%20relevant%20extraction%20logic%20is%20in%20%5Bdeployment_extractor.go%5D%28https%3A//github.com/apache/incubator-devlake/blob/2c15ad880dce830c6512fa58039527cbf4745b8b/backend/plugins/github_graphql/tasks/deployment_extractor.go%23L42-L102%29.%0A%0AThis%20change%20will%20ensure%20PR%20Deploy%20Time%20metrics%20reflect%20the%20actual%20deployment%20completion%2C%20not%20when%20it%20was%20superseded.%20If%20you%20need%20help%20navigating%20the%20code%20or%20want%20to%20discuss%20implementation%20details%2C%20let%20me%20know%21) [! [Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/incubator-devlake/issues/8654) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
