This commit is contained in:
biss committed 2026-08-14 19:28:58 +08:00
1 parent 54e1986ad0
commit ccdfe977ba
9 files changed
+175 -17

No files matched your search

@@ -323,10 +323,7 @@ public sealed class CoursesController(
if (scope.Scope == DataScope.All) return source; if (scope.Scope == DataScope.All) return source;
if (scope.Scope == DataScope.College) if (scope.Scope == DataScope.College)
{ {
return source.Where(x => return source.Where(x => x.CollegeId == scope.RestrictedCollegeId);
x.Nature == CourseNature.GeneralRequired ||
x.Nature == CourseNature.GeneralElective ||
x.CollegeId == scope.RestrictedCollegeId);
} }
if (scope.Scope == DataScope.Class) if (scope.Scope == DataScope.Class)
{ {
@@ -290,10 +290,7 @@ public sealed class CoursesExcelController(
if (scope.Scope == DataScope.All) return source; if (scope.Scope == DataScope.All) return source;
if (scope.Scope == DataScope.College) if (scope.Scope == DataScope.College)
{ {
return source.Where(x => return source.Where(x => x.CollegeId == scope.RestrictedCollegeId);
x.Nature == CourseNature.GeneralRequired ||
x.Nature == CourseNature.GeneralElective ||
x.CollegeId == scope.RestrictedCollegeId);
} }
if (scope.Scope == DataScope.Class) if (scope.Scope == DataScope.Class)
{ {
@@ -125,6 +125,36 @@ public sealed class CurriculumPlansController(
return Ok(new { Colleges = colleges, Majors = majorOptions, Grades = grades }); return Ok(new { Colleges = colleges, Majors = majorOptions, Grades = grades });
} }
[HttpGet("course-options")]
public async Task<ActionResult> GetCourseOptions(CancellationToken cancellationToken)
{
// A plan may deliberately reference enabled courses offered by another college.
// This endpoint is limited to curriculum-plan managers; it must not share the
// course-catalogue list scope used for ordinary catalogue browsing.
var courses = await db.Courses.AsNoTracking()
.Where(x => x.IsEnabled)
.OrderBy(x => x.SortOrder)
.ThenBy(x => x.Code)
.Select(x => new
{
x.Id,
x.Code,
x.Name,
x.CollegeId,
CollegeName = x.College!.Name,
x.CourseCategoryId,
CategoryName = x.CourseCategory != null ? x.CourseCategory.Name : null,
x.Credits,
x.TotalHours,
x.LectureHours,
x.PracticeHours,
x.Nature,
x.AssessmentMethod
})
.ToListAsync(cancellationToken);
return Ok(courses);
}
[HttpGet("{id:guid}")] [HttpGet("{id:guid}")]
public async Task<ActionResult> GetPlan(Guid id, CancellationToken cancellationToken) public async Task<ActionResult> GetPlan(Guid id, CancellationToken cancellationToken)
{ {
Loaded 3 of 9 files, more files were not shown because too many files have changed in this diff. Show more