function dedupeActivity(activity) {
  const { segment_efforts } = activity;
  if (!segment_efforts || !segment_efforts.length) {
    return;
  }

  const dedupedEfforts = dedupeSegmentEfforts(segment_efforts);

  const nextLaps = dedupedEfforts.length + 1;

  activity.set({
    segment_efforts: dedupedEfforts,
    laps: nextLaps,
  });
  activity.markModified('segment_efforts');
}
/**
 * Dedupe segment efforts and update laps for an existing activity
 *
 * @param {Activity} activity Activity document
 */
Dedupe segment efforts and update laps for an existing activity
@param {Activity} activity Activity document
Dedupe segment efforts and update laps for an existing activity @param { Activity } activity Activity document
function dedupeActivity(activity) {
  const { segment_efforts } = activity;
  if (!segment_efforts || !segment_efforts.length) {
    return;
  }
  const dedupedEfforts = dedupeSegmentEfforts(segment_efforts);
  const nextLaps = dedupedEfforts.length + 1;
  activity.set({
    segment_efforts: dedupedEfforts,
    laps: nextLaps,
  });
  activity.markModified('segment_efforts');
}
function dedupeActivity ( activity ) { const { segment_efforts } = activity ; if ( ! segment_efforts || ! segment_efforts . length ) { return ; } const dedupedEfforts = dedupeSegmentEfforts ( segment_efforts ) ; const nextLaps = dedupedEfforts . length + 1 ; activity . set ( { segment_efforts : dedupedEfforts , laps : nextLaps , } ) ; activity . markModified ( 'segment_efforts' ) ; }
Dedupe segment efforts and update laps for an existing activity
 @param {Activity} activity Activity document
Dedupe segment efforts and update laps for an existing activity @param { Activity } activity Activity document