File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed
src/Libraries/SmartStore.Services/Tasks Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -299,6 +299,17 @@ protected virtual IQueryable<ScheduleTaskHistory> GetHistoryEntriesQuery(
299299 {
300300 var query = _taskHistoryRepository . TableUntracked ;
301301
302+ if ( lastEntryOnly )
303+ {
304+ query =
305+ from th in query
306+ group th by th . ScheduleTaskId into grp
307+ select grp
308+ . OrderByDescending ( x => x . StartedOnUtc )
309+ . ThenByDescending ( x => x . Id )
310+ . FirstOrDefault ( ) ;
311+ }
312+
302313 if ( taskId != 0 )
303314 {
304315 query = query . Where ( x => x . ScheduleTaskId == taskId ) ;
@@ -313,17 +324,6 @@ protected virtual IQueryable<ScheduleTaskHistory> GetHistoryEntriesQuery(
313324 query = query . Where ( x => x . IsRunning == isRunning . Value ) ;
314325 }
315326
316- if ( lastEntryOnly )
317- {
318- query =
319- from th in query
320- group th by th . ScheduleTaskId into grp
321- select grp
322- . OrderByDescending ( x => x . StartedOnUtc )
323- . ThenByDescending ( x => x . Id )
324- . FirstOrDefault ( ) ;
325- }
326-
327327 query = query
328328 . OrderByDescending ( x => x . StartedOnUtc )
329329 . ThenByDescending ( x => x . Id ) ;
You can’t perform that action at this time.
0 commit comments