🐛 Fix read-only annotation tasks returned to their authors #21
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user