Energinet-DataHub / ARCHIVED-geh-charges

Apache License 2.0
7 stars 3 forks source link

fix: update how to calculate number of month #1781

Closed Mech0z closed 2 years ago

Mech0z commented 2 years ago

Description

this fixes a bug where calculation of month used UTC time, now it uses locallized time instead

If we used utc on 2022-06-14T22:00Z and 2022-07-31T22:00Z and used .month an subtracted them from each other we got 7-6=1, if its converted to localtime 2022-06-15 and 2022-08-01, the correct 8-6=2 month is calculated.

This also fixes an error in expected points in a test case with irregular price series going from summer to wintertime .

References

codecov[bot] commented 2 years ago

Codecov Report

Merging #1781 (33b1200) into main (e9d4603) will increase coverage by 45.14%. The diff coverage is 100.00%.

@@             Coverage Diff             @@
##             main    #1781       +/-   ##
===========================================
+ Coverage   38.16%   83.30%   +45.14%     
===========================================
  Files          24      503      +479     
  Lines         414     9160     +8746     
  Branches       22       22               
===========================================
+ Hits          158     7631     +7473     
- Misses        241     1386     +1145     
- Partials       15      143      +128     
Flag Coverage Δ
business 85.44% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ChargePriceOperationInputValidationRulesFactory.cs 100.00% <100.00%> (ø)
...umberOfPointsMatchTimeIntervalAndResolutionRule.cs 96.29% <100.00%> (ø)
...nfrastructure.Core/Function/HttpResponseBuilder.cs 95.23% <0.00%> (ø)
.../ValidationRules/ChargeNameHasMaximumLengthRule.cs 100.00% <0.00%> (ø)
...ers/Application/ChargePriceCommandBundleBuilder.cs 100.00% <0.00%> (ø)
...s/AvailableData/AvailableReceiptValidationError.cs 100.00% <0.00%> (ø)
...Attributes/Customizations/ProtobufCustomization.cs 73.91% <0.00%> (ø)
....Core/Cim/MarketActivityRecord/ReasonCodeMapper.cs 100.00% <0.00%> (ø)
...structure/Persistence/MessageHubDatabaseContext.cs 94.44% <0.00%> (ø)
...rgyHub.Charges.QueryApi/Model/DefaultChargeLink.cs 83.33% <0.00%> (ø)
... and 471 more

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

sonarcloud[bot] commented 2 years ago

Please retry analysis of this Pull-Request directly on SonarCloud.

Mech0z commented 2 years ago

Replaced by https://github.com/Energinet-DataHub/geh-charges/pull/1781