Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class CourseImportHelper(ProgramRepository programRepository) {

public async Task<IEnumerable<CourseImportEntry>> GetLog(string sourceCode) {
var sourceId = _programRepository.Read(c => c.Sources.FirstOrDefault(s => s.Code == sourceCode))?.Id ?? 0;
return await _programRepository.ReadAsync(pr => pr.CourseImportEntries.Where(c => c.SourceId == sourceId).OrderByDescending(c => c.LastUpdated));
return await _programRepository.ReadAsync(pr => pr.CourseImportEntries.Where(c => c.SourceId == sourceId).OrderBy(c => c.Rubric).ThenBy(c => c.CourseNumber));
}

public async Task<int> LoadComplete(string rubric, string courseNumber, string urlPattern, bool importTitleAndDescriptionOnly, bool includeSections, string sourceCode, string log) {
Expand Down
16 changes: 3 additions & 13 deletions ProgramInformationV2.Function/GetTags.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Net;
using Microsoft.AspNetCore.Http;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Http;
Expand All @@ -8,22 +7,13 @@
using ProgramInformationV2.Data.DataHelpers;
using ProgramInformationV2.Function.Helper;
using ProgramInformationV2.Search.JsonThinModels;
using System.Net;

namespace ProgramInformationV2.Function {

public class GetTags(FilterHelper filterHelper, ILogger<GetPrograms> logger) {
public class GetTags(FilterHelper filterHelper, ILogger<GetTags> logger) {
private readonly FilterHelper _filterHelper = filterHelper;
private readonly ILogger<GetPrograms> _logger = logger;

[Function("Check")]
[OpenApiOperation(operationId: "Check", tags: "Check Information", Description = "Get check information.")]
[OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(List<TagList>), Description = "Standard response")]
public async Task<HttpResponseData> Check([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequestData req) {
_logger.LogInformation("Called Check.");
var response = req.CreateResponse(HttpStatusCode.OK);
await response.WriteAsJsonAsync("Check");
return response;
}
private readonly ILogger<GetTags> _logger = logger;

[Function("Tags")]
[OpenApiOperation(operationId: "Tags", tags: "Get Tag Information", Description = "Get tag information.")]
Expand Down
6 changes: 5 additions & 1 deletion ProgramInformationV2.Function/LoadCourseFromSchedule.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using System.Net;
using Microsoft.AspNetCore.Http;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Http;
using Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Attributes;
using Microsoft.Extensions.Logging;
using ProgramInformationV2.Data.CourseImport;
using ProgramInformationV2.Data.DataHelpers;
using System.Net;

namespace ProgramInformationV2.Function;

Expand All @@ -20,7 +21,10 @@ public LoadCourseFromSchedule(CourseImportManager courseImportManager, CourseImp
}

[Function("LoadCourseFromSchedule")]
[OpenApiOperation(operationId: "LoadCourseFromSchedule", tags: "Load Course From Schedule", Description = "Load Course that was scheduled using the UI. This will only do one at a time because of the load it causes on the courses.illinois.edu/cisapp process. Recommend only running this once every 10 seconds.")]
[OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(string), Description = "Response describing what was done")]
public async Task<HttpResponseData> ScheduledLoad([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequestData req) {
_logger.LogInformation("Called LoadCourseFromSchedule.");
var item = await _courseImportHelper.GetLatestPending();
var response = req.CreateResponse(HttpStatusCode.OK);
if (item == null) {
Expand Down
22 changes: 22 additions & 0 deletions ProgramInformationV2.Function/StatusFunction.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Microsoft.AspNetCore.Http;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Http;
using Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Attributes;
using Microsoft.Extensions.Logging;
using System.Net;

namespace ProgramInformationV2.Function;

public class StatusFunction(ILogger<StatusFunction> logger) {
private readonly ILogger<StatusFunction> _logger = logger;

[Function("Check")]
[OpenApiOperation(operationId: "Check", tags: "Health Check", Description = "Get health check information.")]
[OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "text/plain", bodyType: typeof(string), Description = "Standard response")]
public async Task<HttpResponseData> Check([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequestData req) {
_logger.LogInformation("Called Check.");
var response = req.CreateResponse(HttpStatusCode.OK);
await response.WriteAsJsonAsync("Check");
return response;
}
}
2 changes: 1 addition & 1 deletion ProgramInformationV2/Components/Pages/Course/Import.razor
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
This will run / schedule a course import from the Electronic Data Warehouse. You can do one of two options:
</p>
<ol>
<li><strong>By Rubric:</strong> this will load all of a specific rubric into your source. <strong>This will always overwrite your existing course information</strong>. This is asynchronous and make take a while to run; <a href="/audit/courseimportlog">you can view the logs</a> to see the progress of the import.</li>
<li><strong>By Rubric:</strong> this will load all of a specific rubric into your source. <strong>This will always overwrite your existing course information</strong>. This is asynchronous and make take a while to run; <a href="/audit/courseimportlog">you can view the logs</a> to see the progress of the import. If you have many rubrics, you can include them in a comma-delimited list and it will load all of them.</li>
<li><strong>By Rubric and Course Number:</strong> this will load a specific course into your source. This will run immediately, and you have the option to overwrite the source information or just load new sections.</li>
</ol>
<p>We look back five years in the past to get data from the current year, and forward one year (so if it is any date in 2026, then we go back to Spring Semester 2021, and forward to Fall Semester 2027).</p>
Expand Down
Loading