parseIterationChangelog function is used to parse the iteration changelog
(taskCtx plugin.SubTaskContext, old string, new string)
| 99 | |
| 100 | // parseIterationChangelog function is used to parse the iteration changelog |
| 101 | func 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 |
| 133 | func GetRawMessageDirectFromResponse(res *http.Response) ([]json.RawMessage, errors.Error) { |