dosubot[bot] commented on issue #8255: URL: https://github.com/apache/incubator-devlake/issues/8255#issuecomment-2567373234
<!-- Answer --> The issue you're encountering is due to the current implementation of the `GetMergeRequestsIterator` function, which only considers open merge requests for note collection. This is intended to speed up the process by focusing on active merge requests <sup>[[1]](https://github.com/apache/incubator-devlake/blob/main/backend/plugins/gitlab/tasks/shared.go)</sup>. To address this and include notes from closed or merged merge requests, you would need to modify the `GetMergeRequestsIterator` function. Specifically, you can adjust the SQL `WHERE` condition to include "closed" and "merged" states in addition to "opened". Here's a snippet of how you can modify the code: ```go func GetMergeRequestsIterator(taskCtx plugin.SubTaskContext, apiCollector *api.StatefulApiCollector) (*api.DalCursorIterator, errors.Error) { db := taskCtx.GetDal() data := taskCtx.GetData().(*GitlabTaskData) clauses := []dal.Clause{ dal.Select("gmr.gitlab_id, gmr.iid"), dal.From("_tool_gitlab_merge_requests gmr"), // collect notes and commits for opened, closed, and merged merge requests dal.Where( `gmr.project_id = ? and gmr.connection_id = ? AND state IN (?, ?, ?)`, data.Options.ProjectId, data.Options.ConnectionId, "opened", "closed", "merged", ), } if apiCollector != nil { if apiCollector.GetSince() != nil { clauses = append(clauses, dal.Where("gitlab_updated_at > ?", *apiCollector.GetSince())) } } // construct the input iterator cursor, err := db.Cursor(clauses...) if err != nil { return nil, err } return api.NewDalCursorIterator(db, cursor, reflect.TypeOf(GitlabInput{})) } ``` This change will allow the collection of notes from all states of merge requests, ensuring that historical and lifecycle-complete notes are included in the data collection process <sup>[[1]](https://github.com/apache/incubator-devlake/blob/main/backend/plugins/gitlab/tasks/shared.go)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/6b1f0fb3-b7b5-4730-90e6-509e3034065b?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/6b1f0fb3-b7b5-4730-90e6-509e3034065b?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/6b1f0fb3-b7b5-4730-90e6-509e3034065b?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/6b1f0fb3-b7b5-4730-90e6-509e3034065b?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/6b1f0fb3-b7b5-4730-90e6-509e3034065b?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/6b1f0fb3-b7b5-4730-90e6-509e3034065b?feedback_type=other)</sup> -- 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: dev-unsubscr...@devlake.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org