Skip to content

Commit

Permalink
[fix] TariffMapper: fix to properly map day-night and three-rate tariffs
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanw-mobile committed Nov 21, 2024
1 parent 50814b9 commit 417a89e
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ fun SingleEnergyProductQuery.EnergyProduct.toTariff(
tariffCode: String,
): Tariff? {
val tariffNode = tariffs?.edges
?.firstOrNull { it?.node?.onStandardTariff?.tariffCode == tariffCode }
?.firstOrNull {
it?.node?.onStandardTariff?.tariffCode == tariffCode ||
it?.node?.onDayNightTariff?.tariffCode == tariffCode ||
it?.node?.onThreeRateTariff?.tariffCode == tariffCode
}
?.node

if (tariffNode == null) {
Expand Down

0 comments on commit 417a89e

Please sign in to comment.