biweeklybudget.models.fuel module

class biweeklybudget.models.fuel.FuelFill(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base, biweeklybudget.models.base.ModelAsDict

_previous_entry()[source]

Get the previous fill for this vehicle by odometer reading, or None.

Returns:the previous fill for this vehicle, by odometer reading, or None.
Return type:biweeklybudget.models.fuel.FuelFill
_sa_class_manager = {'calculated_miles': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'calculated_mpg': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'cost_per_gallon': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'date': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'fill_location': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'gallons': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'level_after': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'level_before': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'notes': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'odometer_miles': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'reported_miles': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'reported_mpg': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'total_cost': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'vehicle': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'vehicle_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}
calculate_mpg()[source]

Calculate calculated_mpg field.

Returns:True if recalculate, False if unable to calculate
Return type:bool
calculated_miles

Number of miles actually traveled since the last fill.

calculated_mpg

Calculated MPG, based on last fill

cost_per_gallon

Fuel cost per gallon

date

date of the fill

fill_location

Location of fill - usually a gas station name/address

gallons

Total amount of fuel (gallons)

id

Primary Key

level_after

Fuel level after fill, as a percentage (Integer 0-100)

level_before

Fuel level before fill, as a percentage (Integer 0-100)

notes

Notes

odometer_miles

Odometer reading of the vehicle, in miles

reported_miles

Number of miles the vehicle thinks it’s traveled since the last fill.

reported_mpg

MPG as reported by the vehicle itself

total_cost

Total cost of fill

validate_gallons(_, value)[source]
validate_odometer_miles(_, value)[source]
vehicle

The vehicle

vehicle_id

ID of the vehicle

class biweeklybudget.models.fuel.Vehicle(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base, biweeklybudget.models.base.ModelAsDict

_sa_class_manager = {'fuellog': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'is_active': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}
fuellog
id

Primary Key

is_active

whether active or historical

name

Name of vehicle