Closed CM000n closed 10 months ago
Attention: 18 lines
in your changes are missing coverage. Please review.
Comparison is base (
66ad51e
) 72.36% compared to head (0373179
) 71.92%.
Files | Patch % | Lines |
---|---|---|
mytoyota/models/summary.py | 10.00% | 18 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
During testing, I came across another problem. For example, a monthly statistic for December 2023 returns the following values
pp.pprint(
f"Summary: {[[x] for x in await car.get_summary(date(2023, 12, 1), date(2023, 12, 31), summary_type=SummaryType.MONTHLY)]}" # noqa: E501
)
("Summary: [[average_speed=41.09 countries=['DE'] duration=16:52:14 "
'distance=693.167 ev_duration=5:34:22 ev_distance=197.999 '
'from_date=2023-12-01 to_date=2023-12-31 fuel_consumed=44.157]]')
But I definitely didn't consume 44 litres per 100 km 🤯 The app also shows me a more realistic 6.4l/100km. So it seems to calculate the values differently somehow.
This is not directly due to a problem with the conversion or processing of the values, as 44157.0 ml are also returned in the original _SummaryBaseModel
used:
{
"length": 693167,
"duration": 60734,
"duration_idle": 2125,
"countries": [
"DE"
],
"max_speed": 132.0,
"average_speed": 41.09,
"length_overspeed": 66006,
"duration_overspeed": 3493,
"length_highway": 59361,
"duration_highway": 2255,
"fuel_consumption": 44157.0
}
.::edit::.
It seems to be calculated by length
and fuel_consumption
:
(44157.0 / 693167) * 100
>> 6.370326342713948
Fix for: https://github.com/DurgNomis-drol/mytoyota/issues/287
The
metric
was converted from abool
to astring
when theself
variables was declared. This meant that simple conditions such asif self._metric
no longer worked and the conversion of the fuel consumption failed, or rather the value for gallons was always returned.self._metric
is now a bool again and a new variableself._distance_unit
was introduced, which is used for the conversion of distances.