warren830 commented on code in PR #4477:
URL:
https://github.com/apache/incubator-devlake/pull/4477#discussion_r1113095928
##########
backend/plugins/sonarqube/impl/impl.go:
##########
@@ -123,30 +123,22 @@ func (p Sonarqube) PrepareTaskData(taskCtx
plugin.TaskContext, options map[strin
Options: op,
ApiClient: apiClient,
}
- if op.ProjectKey != "" {
- var scope *models.SonarqubeProject
- var apiProject *tasks.SonarqubeApiProject
- // support v100 & advance mode
- // If we still cannot find the record in db, we have to request
from remote server and save it to db
- db := taskCtx.GetDal()
- err = db.First(&scope, dal.Where("connection_id = ? AND
project_key = ?", op.ConnectionId, op.ProjectKey))
- if err != nil && db.IsErrorNotFound(err) {
- apiProject, err = api.GetApiProject(op.ProjectKey,
apiClient)
- if err != nil {
- return nil, err
- }
- logger.Debug(fmt.Sprintf("Current project: %s",
apiProject.ProjectKey))
- scope = tasks.ConvertProject(apiProject)
- scope.ConnectionId = op.ConnectionId
- err = taskCtx.GetDal().CreateIfNotExist(&scope)
- if err != nil {
- return nil, err
- }
- }
- if err != nil {
- return nil, errors.Default.Wrap(err, fmt.Sprintf("fail
to find project: %s", op.ProjectKey))
- }
+ // even we have project in _tool_sonaqube_projects, we still need to
collect project to update LastAnalysisDate
Review Comment:
but this come from the same api. Hmm, maybe we don't need to update the
model, just set the value to taskData
--
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]