Skip to content

Commit

Permalink
feat: PeriodStat marathon
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-29 committed Dec 9, 2023
1 parent 523b0c7 commit 933841c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,16 @@ const filterCityRuns = (run: Activity, city: string) => {
const filterTitleRuns = (run: Activity, title: string) =>
titleForRun(run) === title;

const filterTypeRuns = (run: Activity, type: string) => run.type === type;
const filterTypeRuns = (run: Activity, type: string) => {
switch (type){
case 'Full Marathon':
return run.type === 'Run' && run.distance > 40000
case 'Half Marathon':
return run.type === 'Run' && run.distance < 40000 && run.distance > 20000
default:
return run.type === type
}
}

const filterAndSortRuns = (
activities: Activity[],
Expand Down

0 comments on commit 933841c

Please sign in to comment.