Energinet-DataHub / ARCHIVED-geh-charges

Apache License 2.0
7 stars 3 forks source link

Fix: Remove irrelevant `newChargePeriod.EndDateTime` check in `Charge.Update()`: true cannot be reached #1794

Closed prtandrup closed 2 years ago

prtandrup commented 2 years ago

Description

This PR removes this code section in Charge.Update():

image

Code cannot be reached due to validation rule VR.917, which guards any requests where termination date does not equal effective date. Without this rule it would have been possible to reach Charge.Update with an newChargePeriod.EndDateTime that was not equal EndDefault;

image

Right now, for an operation deemed charge update, the new charge period created will be set to EndDefault as chargeInformationOperationDto.EndDateTime is null:

image

References

codecov[bot] commented 2 years ago

Codecov Report

Merging #1794 (34747c7) into main (edb5c13) will increase coverage by 50.73%. The diff coverage is n/a.

@@             Coverage Diff             @@
##             main    #1794       +/-   ##
===========================================
+ Coverage   34.51%   85.25%   +50.73%     
===========================================
  Files          24      514      +490     
  Lines         478     9316     +8838     
  Branches       22       22               
===========================================
+ Hits          165     7942     +7777     
- Misses        298     1225      +927     
- Partials       15      149      +134     
Flag Coverage Δ
business 87.99% <ø> (?)

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

Impacted Files Coverage Δ
...ce/GreenEnergyHub.Charges.Domain/Charges/Charge.cs 96.17% <ø> (ø)
...ges.ApplyDBMigrationsApp/Helpers/ScriptComparer.cs 100.00% <0.00%> (ø)
...st/ChargeLinks/CreateChargeLinkReceiverEndpoint.cs 0.00% <0.00%> (ø)
...parentInvoicingIsNotAllowedForFeeValidationRule.cs 100.00% <0.00%> (ø)
...st.Core/Authorization/ClientCredentialsSettings.cs 0.00% <0.00%> (ø)
...rgeLinksAcceptedEvents/ChargeLinksAcceptedEvent.cs 100.00% <0.00%> (ø)
...cture/Persistence/Repositories/ChargeRepository.cs 74.41% <0.00%> (ø)
...les/ChargeReceipt/ChargeReceiptCimXmlSerializer.cs 95.23% <0.00%> (ø)
...ailableChargeLinksData/AvailableChargeLinksData.cs 100.00% <0.00%> (ø)
...rges.Domain/MeteringPoints/MeteringPointFactory.cs 100.00% <0.00%> (ø)
... and 481 more

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

sonarcloud[bot] commented 2 years ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information