diff --git a/internal/api/annotation_operations.go b/internal/api/annotation_operations.go index 90ebf469..9da1fdd3 100644 --- a/internal/api/annotation_operations.go +++ b/internal/api/annotation_operations.go @@ -3073,6 +3073,7 @@ func (server *server) handleFanyuV5CombinedQualityReview(writer http.ResponseWri item.Status = domain.HumanItemRework item.AssignedUserID = returnAuthor if returnAuthor != "" { + item.Status = domain.HumanItemClaimed item.ClaimedAt = now } } diff --git a/internal/api/review_decision_plan.go b/internal/api/review_decision_plan.go index 9b55c97a..ed15099f 100644 --- a/internal/api/review_decision_plan.go +++ b/internal/api/review_decision_plan.go @@ -37,6 +37,7 @@ func (s *server) planQualityReviewDecision(w http.ResponseWriter, r *http.Reques item.Status = domain.HumanItemRework item.AssignedUserID, task.AssignedUserID = returnAuthor, returnAuthor if returnAuthor != "" { + item.Status = domain.HumanItemClaimed item.ClaimedAt = now } if item.ReviewRound > item.MaxReworkRounds { diff --git a/internal/api/rework_assignment_test.go b/internal/api/rework_assignment_test.go index 06b20c51..95756e9b 100644 --- a/internal/api/rework_assignment_test.go +++ b/internal/api/rework_assignment_test.go @@ -70,6 +70,9 @@ func TestQualityRejectionReturnsToEligibleAuthor(t *testing.T) { t.Fatal("annotation revision changed") } if expected != "" { + if item.Status != domain.HumanItemClaimed || task.Status != domain.AnnotationTaskStatusRework { + t.Fatalf("returned author must be editable while task remains rework: item=%s task=%s", item.Status, task.Status) + } r := f.request(http.MethodGet, "/api/human-items?pool=mine&projectId="+item.ProjectID, f.annotator, nil) var p struct { Items []domain.HumanItemRecord `json:"items"` @@ -78,6 +81,19 @@ func TestQualityRejectionReturnsToEligibleAuthor(t *testing.T) { if len(p.Items) != 1 { t.Fatalf("returned task missing in author's pool: %s", r.Body.String()) } + seedSliceDictionary(t, f, "同名切片") + draft := map[string]any{"version": item.Version, + "sliceSegments": []map[string]any{{"id": "left", "name": "同名切片", "start": 0.0, "end": 5.0}, {"id": "right", "name": "同名切片", "start": 5.0, "end": 10.0}}, + "segments": []map[string]any{{"id": "left-action", "start": 0.0, "end": 5.0, "description": "修正后的动作"}, {"id": "right-action", "start": 5.0, "end": 10.0, "description": "右段动作"}}, + "statuses": map[string]string{"left": "labeled", "right": "labeled"}} + saved := f.request(http.MethodPut, "/api/plugins/annotation-qa/tasks/"+f.task.ID+"/drafts", f.annotator, draft) + if saved.Code != http.StatusOK { + t.Fatalf("returned author cannot save: %d %s", saved.Code, saved.Body.String()) + } + stale := f.request(http.MethodPut, "/api/plugins/annotation-qa/tasks/"+f.task.ID+"/drafts", f.annotator, draft) + if stale.Code != http.StatusConflict { + t.Fatalf("stale draft must still conflict: %d", stale.Code) + } } }) }