Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implements Trip and Emissions classes #192

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft

Conversation

redfrexx
Copy link
Member

@redfrexx redfrexx commented May 9, 2024

No description provided.

Copy link
Contributor

@codingfabi codingfabi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good in general, just some minor comments :)

"""Class for storing information on emissions"""

co2e: float
distance: float
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate why the Emissions class needs a distance property? It seems unnecessary for two reasons:

  • The object already has the co2e calculated.
  • I assume we reuse the Emissions class for Energy calculations as well. There, it would not make sense to store a distance attribute.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True! We could also make it optional and add an optional "consumption" attribute as well. Then we could use it for both. I would like to keep it attached to the emission calculation results, since it is a good meta information which the user might want to retrieve in a later analysis. What do you think?

Copy link
Member Author

@redfrexx redfrexx May 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or we create child classes TripEmissions and EnergyEmissions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not quite sure if there is a need to keep it as a meta information because the user actually needs to provide the distance information in the first place for now (I agree that this might change once we implement/add the ORS). But we can keep it for now but would need to create child classes because it would be unclean to also use it for the energy emissions.

co2calculator/api/trip.py Show resolved Hide resolved
co2calculator/api/trip.py Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants