diff --git a/server/biz/SubscriptionBiz.cs b/server/biz/SubscriptionBiz.cs index 99a07b3..0702151 100644 --- a/server/biz/SubscriptionBiz.cs +++ b/server/biz/SubscriptionBiz.cs @@ -272,23 +272,15 @@ namespace Sockeye.Biz batchResults.Add(await GetAsync(batchId, false)); } - //order the results back into original - //What is happening here: - //for performance the query is batching a bunch at once by fetching a block of items from the sql server - //however it's returning in db order which is often not the order the id list is in - //so it needs to be sorted back into the same order as the ide list - //This would not be necessary if just fetching each one at a time individually (like in workorder get report data) + //these are individually fetched so there's no need to re-order like most other object types - var orderedList = from id in batch join z in batchResults on id equals z.Id select z; - batchResults = null; - - foreach (Subscription w in orderedList) + foreach (Subscription w in batchResults) { if (!ReportRenderManager.KeepGoing(jobId)) return null; var jo = JObject.FromObject(w); ReportData.Add(jo); } - orderedList = null; + batchResults = null; } vc.Clear(); return ReportData; @@ -316,23 +308,15 @@ namespace Sockeye.Biz batchResults.Add(subItem); } - //order the results back into original - //What is happening here: - //for performance the query is batching a bunch at once by fetching a block of items from the sql server - //however it's returning in db order which is often not the order the id list is in - //so it needs to be sorted back into the same order as the ide list - //This would not be necessary if just fetching each one at a time individually (like in workorder get report data) + //these are individually fetched so there's no need to re-order like most other object types - var orderedList = from id in batch join z in batchResults on id equals z.Id select z; - batchResults = null; - - foreach (SubscriptionItem w in orderedList) + foreach (SubscriptionItem w in batchResults) { if (!ReportRenderManager.KeepGoing(jobId)) return null; var jo = JObject.FromObject(w); ReportData.Add(jo); } - orderedList = null; + batchResults = null; } vc.Clear(); return ReportData;