This commit is contained in:
2023-04-21 22:07:38 +00:00
parent a12595b3cf
commit 76ffaa6910

View File

@@ -272,23 +272,15 @@ namespace Sockeye.Biz
batchResults.Add(await GetAsync(batchId, false)); batchResults.Add(await GetAsync(batchId, false));
} }
//order the results back into original //these are individually fetched so there's no need to re-order like most other object types
//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)
var orderedList = from id in batch join z in batchResults on id equals z.Id select z; foreach (Subscription w in batchResults)
batchResults = null;
foreach (Subscription w in orderedList)
{ {
if (!ReportRenderManager.KeepGoing(jobId)) return null; if (!ReportRenderManager.KeepGoing(jobId)) return null;
var jo = JObject.FromObject(w); var jo = JObject.FromObject(w);
ReportData.Add(jo); ReportData.Add(jo);
} }
orderedList = null; batchResults = null;
} }
vc.Clear(); vc.Clear();
return ReportData; return ReportData;
@@ -316,23 +308,15 @@ namespace Sockeye.Biz
batchResults.Add(subItem); batchResults.Add(subItem);
} }
//order the results back into original //these are individually fetched so there's no need to re-order like most other object types
//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)
var orderedList = from id in batch join z in batchResults on id equals z.Id select z; foreach (SubscriptionItem w in batchResults)
batchResults = null;
foreach (SubscriptionItem w in orderedList)
{ {
if (!ReportRenderManager.KeepGoing(jobId)) return null; if (!ReportRenderManager.KeepGoing(jobId)) return null;
var jo = JObject.FromObject(w); var jo = JObject.FromObject(w);
ReportData.Add(jo); ReportData.Add(jo);
} }
orderedList = null; batchResults = null;
} }
vc.Clear(); vc.Clear();
return ReportData; return ReportData;