async function doReset({ subargs }) {
  const doc = await QueueActivity.findOne({ activityId: subargs[1] });
  if (!doc) {
    console.log(`Could not find QueueActivity ${subargs[1]}`);
  }
  const deleted = await deleteActivity(subargs[1]);
  if (!deleted) {
    console.warn(`Failed to delete QueueActivity ${subargs[1]}, see error logs`);
    return;
  }


  const enqueued = await enqueueActivity(
    {
      object_id: doc.activityId,
      owner_id: doc.athleteId,
    },
    '', // clear errMsg/detail field
  );
  if (!enqueued) {
    console.warn(`Failed to reset QueueActivity ${doc.activityId}, see error logs`);
  } else {
    console.log(`Reset QueueActivity ${doc.activityId} for athlete ${doc.athleteId}`);
  }
}
/**
 * Reset activity to original pending state
 */
Reset activity to original pending state
Reset activity to original pending state
async function doReset({ subargs }) {
  const doc = await QueueActivity.findOne({ activityId: subargs[1] });
  if (!doc) {
    console.log(`Could not find QueueActivity ${subargs[1]}`);
  }
  const deleted = await deleteActivity(subargs[1]);
  if (!deleted) {
    console.warn(`Failed to delete QueueActivity ${subargs[1]}, see error logs`);
    return;
  }
  const enqueued = await enqueueActivity(
    {
      object_id: doc.activityId,
      owner_id: doc.athleteId,
    },
    '', 
  );
  if (!enqueued) {
    console.warn(`Failed to reset QueueActivity ${doc.activityId}, see error logs`);
  } else {
    console.log(`Reset QueueActivity ${doc.activityId} for athlete ${doc.athleteId}`);
  }
}
async function doReset ( { subargs } ) { const doc = await QueueActivity . findOne ( { activityId : subargs [ 1 ] } ) ; if ( ! doc ) { console . log ( ` ${ subargs [ 1 ] } ` ) ; } const deleted = await deleteActivity ( subargs [ 1 ] ) ; if ( ! deleted ) { console . warn ( ` ${ subargs [ 1 ] } ` ) ; return ; } const enqueued = await enqueueActivity ( { object_id : doc . activityId , owner_id : doc . athleteId , } , '' , ) ; if ( ! enqueued ) { console . warn ( ` ${ doc . activityId } ` ) ; } else { console . log ( ` ${ doc . activityId } ${ doc . athleteId } ` ) ; } }
Reset activity to original pending state
Reset activity to original pending state
// clear errMsg/detail field