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 at 0x7fb4e12edba0>, 'calculated_mpg': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fb4e127f150>, 'cost_per_gallon': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fb4e12ede60>, 'date': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fb4e12ed8e0>, 'fill_location': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fb4e12eddb0>, 'gallons': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fb4e12edfc0>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fb4e12ed830>, 'level_after': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fb4e12edd00>, 'level_before': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fb4e12edc50>, 'notes': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fb4e127f200>, 'odometer_miles': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fb4e12eda40>, 'reported_miles': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fb4e12edaf0>, 'reported_mpg': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fb4e127f048>, 'total_cost': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fb4e12edf10>, 'vehicle': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fb4e12ed6d0>, 'vehicle_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fb4e12ed938>}
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 at 0x7fb4df12ea40>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fb4e12ed410>, 'is_active': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fb4e12ed5c8>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fb4e12ed518>}
fuellog
id

Primary Key

is_active

whether active or historical

name

Name of vehicle