Energinet-DataHub / ARCHIVED-geh-charges

Apache License 2.0
7 stars 3 forks source link

Fix: Charge History Persister to cope with `EndDateTime` being `null` #1911

Closed prtandrup closed 1 year ago

prtandrup commented 1 year ago

Description

When the ChargeInformationOperationsAcceptedEvent contains a brand new charge, the EndDateTime is null. This was not anticipated and the ChargeHistoryPersisterEndpoint threw an ArgumentNullException. This PR now handles this scenario, by setting EndDefault when null through a new ChargeHistoryFactory.cs.

Also, the service bus subscription failing has been fixed. Kudos @HenrikSommer for your great :eyes:

Also, I spotted an incorrect document type used in a builder, and changed it (unrelated to the bug).

References

codecov[bot] commented 1 year ago

Codecov Report

Merging #1911 (b141800) into main (f0115c3) will increase coverage by 52.13%. The diff coverage is 91.66%.

@@             Coverage Diff             @@
##             main    #1911       +/-   ##
===========================================
+ Coverage   32.22%   84.36%   +52.13%     
===========================================
  Files          24      461      +437     
  Lines         512     8198     +7686     
  Branches       23       23               
===========================================
+ Hits          165     6916     +6751     
- Misses        332     1138      +806     
- Partials       15      144      +129     
Flag Coverage Δ
business 87.83% <91.66%> (?)
clientlibraries 32.22% <ø> (ø)

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

Impacted Files Coverage Δ
...s.FunctionHost/ChargeLinks/ChargeLinksIngestion.cs 0.00% <ø> (ø)
...ub.Charges.FunctionHost/Charges/ChargeIngestion.cs 0.00% <ø> (ø)
...nHost/Configuration/ServiceCollectionExtensions.cs 47.91% <ø> (ø)
...nEnergyHub.Charges.Infrastructure/ActorProvider.cs 100.00% <ø> (ø)
...nEnergyHub.Charges.QueryApi/Model/ChargeHistory.cs 0.00% <0.00%> (ø)
...nEnergyHub.Charges.QueryApi/Model/ChargeMessage.cs 0.00% <ø> (ø)
...tionHost/Configuration/HealthCheckConfiguration.cs 51.06% <40.00%> (ø)
...nEnergyHub.Charges.Domain/Charges/ChargeHistory.cs 95.18% <95.18%> (ø)
...lication/Charges/Factories/ChargeHistoryFactory.cs 100.00% <100.00%> (ø)
...ndlers/ChargeInformation/ChargeHistoryPersister.cs 100.00% <100.00%> (ø)
... and 442 more

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

sonarcloud[bot] commented 1 year 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

0.0% 0.0% Coverage
0.0% 0.0% Duplication