MCPcopy Index your code
hub / github.com/aiprodcoder/MIXAPI / checkTaskNeedUpdate

Function checkTaskNeedUpdate

controller/task.go:187–226  ·  view source on GitHub ↗
(oldTask *model.Task, newTask dto.SunoDataResponse)

Source from the content-addressed store, hash-verified

185}
186
187func checkTaskNeedUpdate(oldTask *model.Task, newTask dto.SunoDataResponse) bool {
188
189 if oldTask.SubmitTime != newTask.SubmitTime {
190 return true
191 }
192 if oldTask.StartTime != newTask.StartTime {
193 return true
194 }
195 if oldTask.FinishTime != newTask.FinishTime {
196 return true
197 }
198 if string(oldTask.Status) != newTask.Status {
199 return true
200 }
201 if oldTask.FailReason != newTask.FailReason {
202 return true
203 }
204 if oldTask.FinishTime != newTask.FinishTime {
205 return true
206 }
207
208 if (oldTask.Status == model.TaskStatusFailure || oldTask.Status == model.TaskStatusSuccess) && oldTask.Progress != "100%" {
209 return true
210 }
211
212 oldData, _ := json.Marshal(oldTask.Data)
213 newData, _ := json.Marshal(newTask.Data)
214
215 sort.Slice(oldData, func(i, j int) bool {
216 return oldData[i] < oldData[j]
217 })
218 sort.Slice(newData, func(i, j int) bool {
219 return newData[i] < newData[j]
220 })
221
222 if string(oldData) != string(newData) {
223 return true
224 }
225 return false
226}
227
228func GetAllTask(c *gin.Context) {
229 pageInfo := common.GetPageQuery(c)

Callers 1

updateSunoTaskAllFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected