feat: add specific weeks
All checks were successful
.NET Test Pipeline / build-and-test (pull_request) Successful in 1m52s
All checks were successful
.NET Test Pipeline / build-and-test (pull_request) Successful in 1m52s
This commit is contained in:
parent
22579038d3
commit
0d3461b769
@ -39,6 +39,29 @@ public class GroupScheduleInfo
|
||||
[Required]
|
||||
public required int DisciplineId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets exclude or include weeks for a specific discipline.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If is <see langword="true"/>, then the values in <see cref="Weeks"/> show the weeks when there will be no discipline.
|
||||
/// <br/>
|
||||
/// If is <see langword="false"/>, then the values in <see cref="Weeks"/> indicate the weeks during which a particular discipline will be studied.
|
||||
/// <br/>
|
||||
/// If is <see langword="null"/>, then there are no specific <see cref="Weeks"/>
|
||||
/// </remarks>
|
||||
///
|
||||
|
||||
public bool? IsExcludedWeeks { get; set; }
|
||||
/// <summary>
|
||||
/// The week numbers required for the correct display of the schedule.
|
||||
/// <br/>
|
||||
/// Whether there will be <see cref="Discipline"/> during the week or not depends on the <see cref="IsExcludedWeeks"/> property.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// To get the current week's number, use other queries.
|
||||
/// </remarks>
|
||||
public IEnumerable<int>? Weeks { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type of occupation for the schedule entry.
|
||||
/// </summary>
|
||||
|
@ -39,6 +39,29 @@ public class LectureHallScheduleInfo
|
||||
[Required]
|
||||
public required int DisciplineId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets exclude or include weeks for a specific discipline.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If is <see langword="true"/>, then the values in <see cref="Weeks"/> show the weeks when there will be no discipline.
|
||||
/// <br/>
|
||||
/// If is <see langword="false"/>, then the values in <see cref="Weeks"/> indicate the weeks during which a particular discipline will be studied.
|
||||
/// <br/>
|
||||
/// If is <see langword="null"/>, then there are no specific <see cref="Weeks"/>
|
||||
/// </remarks>
|
||||
///
|
||||
|
||||
public bool? IsExcludedWeeks { get; set; }
|
||||
/// <summary>
|
||||
/// The week numbers required for the correct display of the schedule.
|
||||
/// <br/>
|
||||
/// Whether there will be <see cref="Discipline"/> during the week or not depends on the <see cref="IsExcludedWeeks"/> property.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// To get the current week's number, use other queries.
|
||||
/// </remarks>
|
||||
public IEnumerable<int>? Weeks { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type of occupation for the schedule entry.
|
||||
/// </summary>
|
||||
|
@ -39,6 +39,29 @@ public class ProfessorScheduleInfo
|
||||
[Required]
|
||||
public required int DisciplineId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets exclude or include weeks for a specific discipline.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If is <see langword="true"/>, then the values in <see cref="Weeks"/> show the weeks when there will be no discipline.
|
||||
/// <br/>
|
||||
/// If is <see langword="false"/>, then the values in <see cref="Weeks"/> indicate the weeks during which a particular discipline will be studied.
|
||||
/// <br/>
|
||||
/// If is <see langword="null"/>, then there are no specific <see cref="Weeks"/>
|
||||
/// </remarks>
|
||||
///
|
||||
|
||||
public bool? IsExcludedWeeks { get; set; }
|
||||
/// <summary>
|
||||
/// The week numbers required for the correct display of the schedule.
|
||||
/// <br/>
|
||||
/// Whether there will be <see cref="Discipline"/> during the week or not depends on the <see cref="IsExcludedWeeks"/> property.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// To get the current week's number, use other queries.
|
||||
/// </remarks>
|
||||
public IEnumerable<int>? Weeks { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type of occupation for the schedule entry.
|
||||
/// </summary>
|
||||
|
@ -39,6 +39,29 @@ public class ScheduleResponse
|
||||
[Required]
|
||||
public required int DisciplineId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets exclude or include weeks for a specific discipline.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If is <see langword="true"/>, then the values in <see cref="Weeks"/> show the weeks when there will be no discipline.
|
||||
/// <br/>
|
||||
/// If is <see langword="false"/>, then the values in <see cref="Weeks"/> indicate the weeks during which a particular discipline will be studied.
|
||||
/// <br/>
|
||||
/// If is <see langword="null"/>, then there are no specific <see cref="Weeks"/>
|
||||
/// </remarks>
|
||||
///
|
||||
|
||||
public bool? IsExcludedWeeks { get; set; }
|
||||
/// <summary>
|
||||
/// The week numbers required for the correct display of the schedule.
|
||||
/// <br/>
|
||||
/// Whether there will be <see cref="Discipline"/> during the week or not depends on the <see cref="IsExcludedWeeks"/> property.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// To get the current week's number, use other queries.
|
||||
/// </remarks>
|
||||
public IEnumerable<int>? Weeks { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type of occupation for the schedule entry.
|
||||
/// </summary>
|
||||
|
@ -11,17 +11,7 @@ public class GetScheduleListQueryHandler(ILessonDbContext dbContext) : IRequestH
|
||||
{
|
||||
public async Task<ScheduleListVm> Handle(GetScheduleListQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var query = dbContext.Lessons
|
||||
.Include(l => l.LessonAssociations)
|
||||
.ThenInclude(la => la.LectureHall)
|
||||
.ThenInclude(lh => lh!.Campus)
|
||||
.Include(l => l.LessonAssociations)
|
||||
.ThenInclude(la => la.Professor)
|
||||
.Include(l => l.LessonAssociations)
|
||||
.ThenInclude(la => la.TypeOfOccupation)
|
||||
.Include(l => l.Group)
|
||||
.Include(l => l.Discipline)
|
||||
.AsQueryable();
|
||||
var query = dbContext.Lessons.AsQueryable();
|
||||
|
||||
if (request.IsEven != null)
|
||||
query = query.Where(l => l.IsEven == request.IsEven);
|
||||
@ -41,7 +31,17 @@ public class GetScheduleListQueryHandler(ILessonDbContext dbContext) : IRequestH
|
||||
l.LessonAssociations!.Any(la =>
|
||||
la.ProfessorId != null && request.ProfessorIds.Contains(la.ProfessorId.Value)));
|
||||
|
||||
var data = await query.ToArrayAsync(cancellationToken);
|
||||
var data = await query
|
||||
.Include(lesson => lesson.Discipline!)
|
||||
.Include(lesson => lesson.SpecificWeeks)
|
||||
.Include(lesson => lesson.Group!)
|
||||
.Include(lesson => lesson.LessonAssociations!)
|
||||
.ThenInclude(lessonAssociation => lessonAssociation.TypeOfOccupation!)
|
||||
.Include(lesson => lesson.LessonAssociations!)
|
||||
.ThenInclude(lessonAssociation => lessonAssociation.Professor)
|
||||
.Include(lesson => lesson.LessonAssociations!)
|
||||
.ThenInclude(lessonAssociation => lessonAssociation.LectureHall)
|
||||
.ThenInclude(lectureHall => lectureHall!.Campus).ToListAsync(cancellationToken);
|
||||
|
||||
var result = data.Select(l => new ScheduleLookupDto()
|
||||
{
|
||||
@ -55,6 +55,9 @@ public class GetScheduleListQueryHandler(ILessonDbContext dbContext) : IRequestH
|
||||
Discipline = l.Discipline!.Name,
|
||||
DisciplineId = l.DisciplineId,
|
||||
|
||||
IsExcludedWeeks = l.IsExcludedWeeks,
|
||||
Weeks = l.SpecificWeeks?.Select(w => w.WeekNumber),
|
||||
|
||||
Group = l.Group!.Name,
|
||||
GroupId = l.GroupId,
|
||||
|
||||
@ -72,7 +75,6 @@ public class GetScheduleListQueryHandler(ILessonDbContext dbContext) : IRequestH
|
||||
.Where(la => la.LectureHall?.Campus != null)
|
||||
.Select(la => la.LectureHall?.CampusId),
|
||||
|
||||
|
||||
Professors = l.LessonAssociations!
|
||||
.Where(la => !string.IsNullOrEmpty(la.Professor?.Name))
|
||||
.Select(la => la.Professor?.Name),
|
||||
|
@ -33,6 +33,16 @@ public class ScheduleLookupDto
|
||||
/// </summary>
|
||||
public required int DisciplineId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets exclude or include weeks for a specific discipline.
|
||||
/// </summary>
|
||||
public bool? IsExcludedWeeks { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The week numbers required for the correct display of the schedule.
|
||||
/// </summary>
|
||||
public IEnumerable<int>? Weeks { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the group.
|
||||
/// </summary>
|
||||
|
@ -60,6 +60,8 @@ public class ScheduleController(IMediator mediator) : BaseControllerV1
|
||||
IsEven = s.IsEven,
|
||||
Discipline = s.Discipline,
|
||||
DisciplineId = s.DisciplineId,
|
||||
IsExcludedWeeks = s.IsExcludedWeeks,
|
||||
Weeks = s.Weeks,
|
||||
TypeOfOccupations = s.TypeOfOccupations,
|
||||
Group = s.Group,
|
||||
GroupId = s.GroupId,
|
||||
@ -117,6 +119,8 @@ public class ScheduleController(IMediator mediator) : BaseControllerV1
|
||||
IsEven = g.IsEven,
|
||||
Discipline = g.Discipline,
|
||||
DisciplineId = g.DisciplineId,
|
||||
IsExcludedWeeks = g.IsExcludedWeeks,
|
||||
Weeks = g.Weeks,
|
||||
TypeOfOccupations = g.TypeOfOccupations,
|
||||
LectureHalls = g.LectureHalls,
|
||||
LectureHallsId = g.LectureHallsId,
|
||||
@ -176,6 +180,8 @@ public class ScheduleController(IMediator mediator) : BaseControllerV1
|
||||
IsEven = p.IsEven,
|
||||
Discipline = p.Discipline,
|
||||
DisciplineId = p.DisciplineId,
|
||||
IsExcludedWeeks = p.IsExcludedWeeks,
|
||||
Weeks = p.Weeks,
|
||||
TypeOfOccupations = p.TypeOfOccupations,
|
||||
Group = p.Group,
|
||||
GroupId = p.GroupId,
|
||||
@ -235,6 +241,8 @@ public class ScheduleController(IMediator mediator) : BaseControllerV1
|
||||
IsEven = l.IsEven,
|
||||
Discipline = l.Discipline,
|
||||
DisciplineId = l.DisciplineId,
|
||||
IsExcludedWeeks = l.IsExcludedWeeks,
|
||||
Weeks = l.Weeks,
|
||||
TypeOfOccupations = l.TypeOfOccupations,
|
||||
Group = l.Group,
|
||||
GroupId = l.GroupId,
|
||||
|
Loading…
Reference in New Issue
Block a user