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));
}
//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;