MCPcopy
hub / github.com/apache/devlake / parseIterationChangelog

Function parseIterationChangelog

backend/plugins/tapd/tasks/shared.go:101–130  ·  view source on GitHub ↗

parseIterationChangelog function is used to parse the iteration changelog

(taskCtx plugin.SubTaskContext, old string, new string)

Source from the content-addressed store, hash-verified

99
100// parseIterationChangelog function is used to parse the iteration changelog
101func parseIterationChangelog(taskCtx plugin.SubTaskContext, old string, new string) (iterationFromId int64, iterationToId int64, err errors.Error) {
102 data := taskCtx.GetData().(*TapdTaskData)
103 db := taskCtx.GetDal()
104
105 // Find the iteration with the old name
106 iterationFrom := &models.TapdIteration{}
107 clauses := []dal.Clause{
108 dal.From(&models.TapdIteration{}),
109 dal.Where("connection_id = ? and workspace_id = ? and name = ?",
110 data.Options.ConnectionId, data.Options.WorkspaceId, old),
111 }
112 err = db.First(iterationFrom, clauses...)
113 if err != nil && !db.IsErrorNotFound(err) {
114 return 0, 0, err
115 }
116
117 // Find the iteration with the new name
118 iterationTo := &models.TapdIteration{}
119 clauses = []dal.Clause{
120 dal.From(&models.TapdIteration{}),
121 dal.Where("connection_id = ? and workspace_id = ? and name = ?",
122 data.Options.ConnectionId, data.Options.WorkspaceId, new),
123 }
124 err = db.First(iterationTo, clauses...)
125 if err != nil && !db.IsErrorNotFound(err) {
126 return 0, 0, err
127 }
128
129 return iterationFrom.Id, iterationTo.Id, nil
130}
131
132// GetRawMessageDirectFromResponse extracts the raw message from an HTTP response
133func GetRawMessageDirectFromResponse(res *http.Response) ([]json.RawMessage, errors.Error) {

Callers 4

ExtractBugChangelogFunction · 0.85
ExtractStoryChangelogFunction · 0.85
ExtractTaskChangelogFunction · 0.85

Calls 5

GetDataMethod · 0.65
GetDalMethod · 0.65
FromMethod · 0.65
FirstMethod · 0.65
IsErrorNotFoundMethod · 0.65

Tested by 1