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