The following code needs to be optimized:
|
foreach ( DateTime chartTime in chartTimes ) |
|
{ |
|
// Get the active schedules |
|
foreach ( var schedule in schedules ) |
|
{ |
|
if ( schedule.WasScheduleOrCheckInActive( chartTime ) ) |
|
{ |
|
ActiveScheduleIds.Add( schedule.Id ); |
|
|
|
var currentAttendance = new AttendanceService( rockContext ) |
|
.Queryable().AsNoTracking() |
|
.Where( a => |
|
a.StartDateTime > minDate && |
|
!a.EndDateTime.HasValue && |
|
a.Occurrence.LocationId.HasValue && |
|
a.PersonAlias != null && |
|
a.DidAttend.HasValue && |
|
a.DidAttend.Value && |
|
a.Occurrence.ScheduleId.HasValue && |
|
a.Occurrence.ScheduleId == schedule.Id ) |
|
.ToList(); |
|
|
|
if ( currentAttendance.Any() ) |
|
{ |
|
foreach ( var attendance in currentAttendance ) |
|
{ |
|
if ( attendance.Occurrence.LocationId.HasValue && !occurrences.Any( o => o.Id == attendance.OccurrenceId ) ) |
|
{ |
|
occurrences.Add( attendance.Occurrence ); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
A client experienced performance issues from said code. Differences of 14-33 second load times down to 0.5-2 seconds with this code removed.
If we are unable to optimize, we need to confirm what is all affected by this code, give the users a setting to disable it, and display appropriate warnings if/as it causes incorrect data to display.
The following code needs to be optimized:
RockBlocks/CheckIn/Manager/Locations.ascx.cs
Lines 1441 to 1475 in f5c0a7d
A client experienced performance issues from said code. Differences of 14-33 second load times down to 0.5-2 seconds with this code removed.
If we are unable to optimize, we need to confirm what is all affected by this code, give the users a setting to disable it, and display appropriate warnings if/as it causes incorrect data to display.