completed task error fix
This commit is contained in:
parent
b616de42ee
commit
b660072ca1
|
|
@ -721,10 +721,16 @@ func (s *Service) GetCRMElementTitles(
|
|||
|
||||
type taskListResponse struct {
|
||||
Tasks []struct {
|
||||
ID int `json:"id,string"`
|
||||
ID int `json:"id,string"`
|
||||
Status int `json:"status,string"`
|
||||
} `json:"tasks"`
|
||||
}
|
||||
|
||||
const (
|
||||
TaskStatusSupposedly = 4 // ждет контроля
|
||||
TaskStatusCompleted = 5 // завершена
|
||||
)
|
||||
|
||||
func (s *Service) CompleteSubtasks(ctx context.Context, taskID int) error {
|
||||
// Получаем список подзадач
|
||||
var resp taskListResponse
|
||||
|
|
@ -736,7 +742,7 @@ func (s *Service) CompleteSubtasks(ctx context.Context, taskID int) error {
|
|||
"filter": map[string]interface{}{
|
||||
"PARENT_ID": taskID,
|
||||
},
|
||||
"select": []string{"ID"},
|
||||
"select": []string{"ID", "STATUS"},
|
||||
},
|
||||
&resp,
|
||||
)
|
||||
|
|
@ -746,6 +752,10 @@ func (s *Service) CompleteSubtasks(ctx context.Context, taskID int) error {
|
|||
|
||||
// Завершаем каждую подзадачу
|
||||
for _, task := range resp.Tasks {
|
||||
if task.Status == TaskStatusCompleted || task.Status == TaskStatusSupposedly {
|
||||
continue
|
||||
}
|
||||
|
||||
if err := s.call(
|
||||
ctx,
|
||||
"tasks.task.complete",
|
||||
|
|
|
|||
2
main.go
2
main.go
|
|
@ -108,7 +108,7 @@ func processNewTaskEvent(ctx context.Context, event *BitrixEvent, mandatoryAudit
|
|||
|
||||
bitrixService.SetTaskAuditors(ctx, event.GetTaskId(), auditorIDS)
|
||||
|
||||
if taskInfo.CreatorID == taskInfo.ResponsibleID && taskInfo.ParentID == 0 {
|
||||
if taskInfo.CreatorID == taskInfo.ResponsibleID && taskInfo.ParentID != 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue