コード例 #1
0
ファイル: AmtService.cs プロジェクト: stwehrli/TurkR
 /// <summary>
 /// Approves all pending assignments of a hit
 /// </summary>
 /// <param name="hitId">A HitId</param>
 /// <param name="reason">Reason or feedback for the worker</param>
 public void ApproveAllAssignments(int hitId, string reason)
 {
     using (var ctx = new TurkRContext())
     {
         var hit = ctx.Hits.FirstOrDefault(h => h.HitId == hitId);
         if (hit != null)
         {
             SimpleClient myClient = new SimpleClient(_mturkConfig);
             var assignments = myClient.GetAllAssignmentsForHIT(hit.AmtHitId);
             foreach (var a in assignments)
             {
                 if (a.AssignmentStatus == AssignmentStatus.Submitted)
                 {
                     myClient.ApproveAssignment(a.AssignmentId, reason);
                 }
             }
         }
     }
 }
コード例 #2
0
ファイル: AmtService.cs プロジェクト: stwehrli/TurkR
 /// <summary>
 /// Approves an assignment
 /// </summary>
 /// <param name="assignmentId">The Assignment Id</param>
 /// <param name="reason">Reason or feedback for the worker</param>
 public void ApproveAssignment(string assignmentId, string reason)
 {
     SimpleClient myClient = new SimpleClient(_mturkConfig);
     myClient.ApproveAssignment(assignmentId, reason);
 }