Skip to content

Commit

Permalink
Fixed issues from PR
Browse files Browse the repository at this point in the history
  • Loading branch information
hortha committed Feb 7, 2025
1 parent 25b7ddb commit 551ff58
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using TeachingRecordSystem.Core.Jobs.EwcWalesImport;
using TeachingRecordSystem.Core.Jobs.Scheduling;
using TeachingRecordSystem.Core.Services.Establishments.Gias;
using TeachingRecordSystem.Core.Services.PublishApi;

namespace TeachingRecordSystem.Core.Jobs;

Expand Down Expand Up @@ -235,10 +236,11 @@ public static IHostApplicationBuilder AddBackgroundJobs(this IHostApplicationBui
job => job.ExecuteAsync(/*dryRun: */true, CancellationToken.None),
Cron.Never);

var publishApiOptions = sp.GetRequiredService<IOptions<PublishApiOptions>>().Value;
recurringJobManager.AddOrUpdate<RefreshTrainingProvidersJob>(
nameof(RefreshTrainingProvidersJob),
job => job.ExecuteAsync(CancellationToken.None),
Cron.Never);
publishApiOptions.RefreshTrainingProvidersJobSchedule);

return Task.CompletedTask;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace TeachingRecordSystem.Core.Services.PublishApi;

public class PublishApiClient : IPublishApiClient
{
private readonly string[] noLongerAccreditedTrainingProviders = ["10034865", "10005413", "10002327", "10046628", "10055126", "10064183", "10007938"];
private readonly string[] _noLongerAccreditedTrainingProviders = ["10034865", "10005413", "10002327", "10046628", "10055126", "10064183", "10007938"];
private readonly HttpClient _httpClient;
private readonly ResiliencePipeline _resiliencePipeline;

Expand Down Expand Up @@ -34,6 +34,6 @@ public async Task<IReadOnlyCollection<ProviderResource>> GetAccreditedProvidersA

var providerList = await response.Content.ReadFromJsonAsync<ProviderListResponse>();
// Unfortunately the Publish API still includes some training providers that are no longer accredited, so we need to filter these out
return providerList!.Data.Where(p => p.Attributes.Ukprn is not null && !noLongerAccreditedTrainingProviders.Contains(p.Attributes.Ukprn)).AsReadOnly();
return providerList!.Data.Where(p => p.Attributes.Ukprn is not null && !_noLongerAccreditedTrainingProviders.Contains(p.Attributes.Ukprn)).AsReadOnly();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
},
"PublishApi": {
"BaseAddress": "https://api.publish-teacher-training-courses.service.gov.uk/api/public/v1/",
"RefreshTrainingProvidersJobSchedule": "0 3 * * *"
"RefreshTrainingProvidersJobSchedule": "30 2 * * *"
},
"TrsSyncService": {
"PollIntervalSeconds": 60,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public async Task RefreshTrainingProvidersJob_WhenCalledForNewUkprn_AddsNewTrain
}
};


publishApiClient
.Setup(x => x.GetAccreditedProvidersAsync())
.ReturnsAsync(providersExpected);
Expand Down

0 comments on commit 551ff58

Please sign in to comment.