MCPcopy Index your code
hub / github.com/apache/devlake / ConvertTaskLabels

Function ConvertTaskLabels

backend/plugins/tapd/tasks/task_label_convertor.go:40–78  ·  view source on GitHub ↗
(taskCtx plugin.SubTaskContext)

Source from the content-addressed store, hash-verified

38}
39
40func ConvertTaskLabels(taskCtx plugin.SubTaskContext) errors.Error {
41 db := taskCtx.GetDal()
42 rawDataSubTaskArgs, data := CreateRawDataSubTaskArgs(taskCtx, RAW_TASK_TABLE)
43
44 clauses := []dal.Clause{
45 dal.From("_tool_tapd_task_labels l"),
46 dal.Join("left join _tool_tapd_workspace_tasks t on t.task_id = l.task_id AND t.connection_id = l.connection_id"),
47 dal.Where("t.workspace_id = ? and t.connection_id = ?", data.Options.WorkspaceId, data.Options.ConnectionId),
48 dal.Orderby("t.task_id ASC"),
49 }
50
51 cursor, err := db.Cursor(clauses...)
52 if err != nil {
53 return err
54 }
55 defer cursor.Close()
56 taskIdGen := didgen.NewDomainIdGenerator(&models.TapdTask{})
57
58 converter, err := helper.NewDataConverter(helper.DataConverterArgs{
59 RawDataSubTaskArgs: *rawDataSubTaskArgs,
60 InputRowType: reflect.TypeOf(models.TapdTaskLabel{}),
61 Input: cursor,
62 Convert: func(inputRow interface{}) ([]interface{}, errors.Error) {
63 issueLabel := inputRow.(*models.TapdTaskLabel)
64 domainTaskLabel := &ticket.IssueLabel{
65 IssueId: taskIdGen.Generate(issueLabel.TaskId),
66 LabelName: issueLabel.LabelName,
67 }
68 return []interface{}{
69 domainTaskLabel,
70 }, nil
71 },
72 })
73 if err != nil {
74 return err
75 }
76
77 return converter.Execute()
78}

Callers

nothing calls this directly

Calls 7

GenerateMethod · 0.95
ExecuteMethod · 0.95
CreateRawDataSubTaskArgsFunction · 0.70
GetDalMethod · 0.65
FromMethod · 0.65
CursorMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected