fietsboek.summaries module

Module for a yearly/monthly track summary.

class fietsboek.summaries.MonthSummary(month)

Bases: object

A summary over a single month.

Variables:
  • month – Month number (1-12).

  • tracks – List of tracks in this month.

add(track)

Add a track to the summary.

Raises:

ValueError – If the given track has no date set.

Parameters:

track (TrackWithMetadata) – The track to insert.

all_tracks()

Returns all tracks of the summary.

Return type:

List[TrackWithMetadata]

Returns:

All tracks.

property total_length: float

Returns the total length of all tracks in this summary.

Returns:

The total length in meters.

class fietsboek.summaries.Summary(ascending=True)

Bases: object

A summary of a user’s tracks.

Variables:
  • years (dict[int, YearSummary]) – Mapping of year to YearSummary.

  • ascending (bool) – If True, years will be sorted from old-to-new, otherwise they will be sorted new-to-old.

add(track)

Add a track to the summary.

This automatically inserts the track into the right yearly summary.

Raises:

ValueError – If the given track has no date set.

Parameters:

track (fietsboek.model.track.Track) – The track to insert.

all_tracks()

Returns all tracks of the summary.

Return type:

List[TrackWithMetadata]

Returns:

All tracks.

property total_length: float

Returns the total length of all tracks in this summary.

Returns:

The total length in meters.

class fietsboek.summaries.YearSummary(year, ascending=True)

Bases: object

A summary over a single year.

Variables:
  • year – Year number.

  • months – Mapping of month to MonthSummary.

  • ascending (bool) – If True, months will be sorted from old-to-new, otherwise they will be sorted new-to-old.

add(track)

Add a track to the summary.

This automatically inserts the track into the right monthly summary.

Raises:

ValueError – If the given track has no date set.

Parameters:

track (TrackWithMetadata) – The track to insert.

all_tracks()

Returns all tracks of the summary.

Return type:

List[TrackWithMetadata]

Returns:

All tracks.

property total_length: float

Returns the total length of all tracks in this summary.

Returns:

The total length in meters.