Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.

Commit

Permalink
fix: convert task to v2
Browse files Browse the repository at this point in the history
Signed-off-by: Yvonnick Esnault <[email protected]>
  • Loading branch information
yesnault committed Jun 20, 2016
1 parent 9d19a92 commit 9919251
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions controllers/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -785,10 +785,9 @@ func (m *MessagesController) innerConvertTasksToV2(ctx *gin.Context, doConvert b
isDone := false
isDoing := false
isDoingUsername := false
pUsername := strings.Replace(topic.Topic, "/Private/", "", 1)
pUsername = strings.Replace(pUsername, "/Tasks", "", 1)
for _, label := range msg.Labels {

pUsername := strings.Replace(topic.Topic, "/Private/", "", 1)
pUsername = strings.Replace(pUsername, "/Tasks", "", 1)
if strings.Contains(pUsername, "/") {
outInfo = "ERR on topic:" + topic.Topic + ";"
}
Expand All @@ -804,7 +803,7 @@ func (m *MessagesController) innerConvertTasksToV2(ctx *gin.Context, doConvert b
}
}
if !isDone && (!isDoing || !isDoingUsername) {
msg.AddToTasksV2(user.Username, topic)
msg.AddToTasksV2(pUsername, topic)
nbConverted++
}
}
Expand All @@ -828,18 +827,14 @@ func (m *MessagesController) CountConvertManyTopics(ctx *gin.Context) {
// TODO remove this method after migrate tatv1 -> tatv2
func (m *MessagesController) CountEmptyTopic(ctx *gin.Context) {

go m.innerCountEmptyTopic()
ctx.JSON(http.StatusOK, gin.H{"result": "see logs"})
}

func (m *MessagesController) innerCountEmptyTopic() {
countNoTopic, countEmptyTopic, err1, err2 := models.CountEmptyTopic()
if err1 != nil || err2 != nil {
log.Errorf(">>CountEmptyTopic error CountConvertManyTopics true, err1:%s, err2:%s", err1, err2)
return
}

log.Warnf("counttopics countNoTopic:%d; countEmptyTopic:%d", countNoTopic, countEmptyTopic)
out := fmt.Sprintf("counttopics countNoTopic:%d; countEmptyTopic:%d", countNoTopic, countEmptyTopic)
ctx.JSON(http.StatusOK, gin.H{"result": out})
}

// DoConvertManyTopics converts task of tat v1 to task tatv2.
Expand Down

0 comments on commit 9919251

Please sign in to comment.