-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from voynow/2-mid-week-update
2 mid week update
- Loading branch information
Showing
8 changed files
with
432 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from pydantic import BaseModel | ||
|
||
|
||
class ActivitySummary(BaseModel): | ||
date_and_time: str | ||
"""Datetime formatted as 'Monday, August 13, 2024 08:00 PM'""" | ||
|
||
distance_in_miles: float | ||
elevation_gain_in_feet: float | ||
pace_minutes_per_mile: float |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from datetime import datetime | ||
from typing import List | ||
|
||
from pydantic import BaseModel | ||
|
||
from src.types.activity_summary import ActivitySummary | ||
from src.types.training_week import TrainingSession | ||
|
||
|
||
class MidWeekAnalysis(BaseModel): | ||
activities: list[ActivitySummary] | ||
training_week: List[TrainingSession] | ||
|
||
@property | ||
def training_week_future(self): | ||
return self.training_week[datetime.now().weekday() + 1 :] | ||
|
||
@property | ||
def miles_ran(self): | ||
return sum(activity.distance_in_miles for activity in self.activities) | ||
|
||
@property | ||
def miles_target(self): | ||
return sum(session.distance for session in self.training_week) | ||
|
||
@property | ||
def miles_remaining(self): | ||
return self.miles_target - self.miles_ran | ||
|
||
@property | ||
def future_miles_planned(self): | ||
return sum(session.distance for session in self.training_week_future) |
Oops, something went wrong.