ryanw-mobile / OctoMeter

🔥Kotlin Multiplatform Desktop/Android/iOS Energy Tracker app
Other
78 stars 7 forks source link

(#222) Replace discrete Instant parameters with ClosedRange #224

Closed ryanw-mobile closed 2 weeks ago

ryanw-mobile commented 2 weeks ago

Currently we always split data range into two variables as we directly mapped the api response to models, we used to allow end date to be null, as the api uses that to represent "no end date"

This refactoring simply combines them into a range of Instants, and we use Instant.DISTANT_FUTURE to represent "no end date". In this way we eliminated many null handling.

codacy-production[bot] commented 2 weeks ago

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
:white_check_mark: -0.03% (target: -1.00%) :white_check_mark: 56.04%
Coverage variation details | | Coverable lines | Covered lines | Coverage | | ------------- | ------------- | ------------- | ------------- | | Common ancestor commit (4da6a3eac490b0e570abbf2e9c01ea455cacf923) | 1845 | 990 | 53.66% | | | Head commit (c4395d3e487381ef7ce89d30718c8d0e1f2b201d) | 1846 (+1) | 990 (+0) | 53.63% (**-0.03%**) | **Coverage variation** is the difference between the coverage for the head and common ancestor commits of the pull request branch: ` - `
Diff coverage details | | Coverable lines | Covered lines | Diff coverage | | ------------- | ------------- | ------------- | ------------- | | Pull request (#224) | 91 | 51 | **56.04%** | **Diff coverage** is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: `/ * 100%`

See your quality gate settings    Change summary preferences


:rocket: Don’t miss a bit, follow what’s new on Codacy.

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

codecov[bot] commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 55.68182% with 39 lines in your changes missing coverage. Please review.

Project coverage is 50.48%. Comparing base (4da6a3e) to head (c4395d3).

Files Patch % Lines
...ami/ui/model/consumption/ConsumptionQueryFilter.kt 75.67% 9 Missing :warning:
...om/rwmobi/kunigami/ui/viewmodels/UsageViewModel.kt 0.00% 6 Missing :warning:
...om/rwmobi/kunigami/ui/viewmodels/AgileViewModel.kt 0.00% 5 Missing :warning:
...nigami/data/repository/OctopusRestApiRepository.kt 0.00% 4 Missing :warning:
.../kunigami/data/repository/DemoRestApiRepository.kt 0.00% 3 Missing :warning:
...i/kunigami/data/repository/mapper/ProductMapper.kt 0.00% 2 Missing :warning:
...ami/domain/usecase/GetConsumptionAndCostUseCase.kt 84.61% 2 Missing :warning:
...i/kunigami/data/repository/mapper/AccountMapper.kt 0.00% 1 Missing :warning:
...nigami/data/repository/mapper/ConsumptionMapper.kt 0.00% 1 Missing :warning:
...mobi/kunigami/data/repository/mapper/RateMapper.kt 0.00% 1 Missing :warning:
... and 5 more
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #224 +/- ## ========================================== + Coverage 49.74% 50.48% +0.73% ========================================== Files 98 98 Lines 1775 1648 -127 Branches 253 235 -18 ========================================== - Hits 883 832 -51 + Misses 814 742 -72 + Partials 78 74 -4 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.