Skip to content

Commit

Permalink
Merge pull request #251 from DFE-Digital/callback-booking-fix
Browse files Browse the repository at this point in the history
Fix exception on retrieving callback booking quotas
  • Loading branch information
ethax-ross authored Sep 17, 2020
2 parents 641357b + 44f08ba commit 09a72ea
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions GetIntoTeachingApi/Services/CrmService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ public IEnumerable<CallbackBookingQuota> GetCallbackBookingQuotas()
{
return _service.CreateQuery("dfe_callbackbookingquota", Context())
.Where((entity) => entity.GetAttributeValue<DateTime>("dfe_starttime") > DateTime.UtcNow &&
entity.GetAttributeValue<DateTime>("dfe_starttime") < DateTime.UtcNow.AddDays(MaximumCallbackBookingQuotaDaysInAdvance) &&
entity.GetAttributeValue<int>("dfe_websitenumberofbookings") < entity.GetAttributeValue<int>("dfe_websitequota"))
entity.GetAttributeValue<DateTime>("dfe_starttime") < DateTime.UtcNow.AddDays(MaximumCallbackBookingQuotaDaysInAdvance))
.OrderBy((entity) => entity.GetAttributeValue<DateTime>("dfe_starttime"))
.Select((entity) => new CallbackBookingQuota(entity, this));
.Select((entity) => new CallbackBookingQuota(entity, this))
.ToList()
.Where((quota) => quota.NumberOfBookings < quota.Quota); // Doing this in the Dynamics query throws an exception, though I'm not sure why.
}

public IEnumerable<PrivacyPolicy> GetPrivacyPolicies()
Expand Down

0 comments on commit 09a72ea

Please sign in to comment.