async function fetchAthleteHistory(athlete) {
  let lapEfforts = await getLapEffortsHistory(athlete);

  if (!lapEfforts || !lapEfforts.length) {
    return [];
  }

  const prevNumEfforts = lapEfforts.length;
  lapEfforts = dedupeSegmentEfforts(lapEfforts);

  if (prevNumEfforts !== lapEfforts.length) {
    captureSentry(
      'Found duplicate segment efforts',
      'fetchAthleteHistory',
      {
        level: 'info',
        extra: {
          athleteId: athlete.id,
          delta: prevNumEfforts - lapEfforts.length,
        },
      },
    );
  }

  return getActivitiesFromEfforts(lapEfforts);
}
/**
 * Compiled athlete history on initial signup based on segment efforts for canonical lap segment
 *
 * @param {Document} athlete
 * @return {Array} List of activities for athlete
 */
Compiled athlete history on initial signup based on segment efforts for canonical lap segment
@param {Document} athlete
@return {Array} List of activities for athlete
Compiled athlete history on initial signup based on segment efforts for canonical lap segment @param { Document } athlete @return { Array } List of activities for athlete
async function fetchAthleteHistory(athlete) {
  let lapEfforts = await getLapEffortsHistory(athlete);
  if (!lapEfforts || !lapEfforts.length) {
    return [];
  }
  const prevNumEfforts = lapEfforts.length;
  lapEfforts = dedupeSegmentEfforts(lapEfforts);
  if (prevNumEfforts !== lapEfforts.length) {
    captureSentry(
      'Found duplicate segment efforts',
      'fetchAthleteHistory',
      {
        level: 'info',
        extra: {
          athleteId: athlete.id,
          delta: prevNumEfforts - lapEfforts.length,
        },
      },
    );
  }
  return getActivitiesFromEfforts(lapEfforts);
}
async function fetchAthleteHistory ( athlete ) { let lapEfforts = await getLapEffortsHistory ( athlete ) ; if ( ! lapEfforts || ! lapEfforts . length ) { return [ ] ; } const prevNumEfforts = lapEfforts . length ; lapEfforts = dedupeSegmentEfforts ( lapEfforts ) ; if ( prevNumEfforts !== lapEfforts . length ) { captureSentry ( 'Found duplicate segment efforts' , 'fetchAthleteHistory' , { level : 'info' , extra : { athleteId : athlete . id , delta : prevNumEfforts - lapEfforts . length , } , } , ) ; } return getActivitiesFromEfforts ( lapEfforts ) ; }
Compiled athlete history on initial signup based on segment efforts for canonical lap segment
 @param {Document} athlete
 @return {Array} List of activities for athlete
Compiled athlete history on initial signup based on segment efforts for canonical lap segment @param { Document } athlete @return { Array } List of activities for athlete