This commit is contained in:
@@ -590,23 +590,23 @@ namespace Sockeye.Biz
|
|||||||
|
|
||||||
//Add Handlebars JS for compiling and presenting
|
//Add Handlebars JS for compiling and presenting
|
||||||
//https://handlebarsjs.com/
|
//https://handlebarsjs.com/
|
||||||
await page.AddScriptTagAsync(new AddTagOptions() { Path = Path.Combine(ReportJSFolderPath, "sock-hb.js") });
|
await page.AddScriptTagAsync(new AddTagOptions() { Path = Path.Combine(ReportJSFolderPath, "ay-hb.js") });
|
||||||
|
|
||||||
//add Marked for markdown processing
|
//add Marked for markdown processing
|
||||||
//https://github.com/markedjs/marked
|
//https://github.com/markedjs/marked
|
||||||
await page.AddScriptTagAsync(new AddTagOptions() { Path = Path.Combine(ReportJSFolderPath, "sock-md.js") });
|
await page.AddScriptTagAsync(new AddTagOptions() { Path = Path.Combine(ReportJSFolderPath, "ay-md.js") });
|
||||||
|
|
||||||
//add DOM Purify for markdown template sanitization processing
|
//add DOM Purify for markdown template sanitization processing
|
||||||
//https://github.com/cure53/DOMPurify
|
//https://github.com/cure53/DOMPurify
|
||||||
await page.AddScriptTagAsync(new AddTagOptions() { Path = Path.Combine(ReportJSFolderPath, "sock-pf.js") });
|
await page.AddScriptTagAsync(new AddTagOptions() { Path = Path.Combine(ReportJSFolderPath, "ay-pf.js") });
|
||||||
|
|
||||||
//add Bar code library if our bar code helper is referenced
|
//add Bar code library if our bar code helper is referenced
|
||||||
//https://github.com/metafloor/bwip-js
|
//https://github.com/metafloor/bwip-js
|
||||||
if (report.Template.Contains("ayBC ") || report.JsHelpers.Contains("ayBC "))
|
if (report.Template.Contains("ayBC ") || report.JsHelpers.Contains("ayBC "))
|
||||||
await page.AddScriptTagAsync(new AddTagOptions() { Path = Path.Combine(ReportJSFolderPath, "sock-bc.js") });
|
await page.AddScriptTagAsync(new AddTagOptions() { Path = Path.Combine(ReportJSFolderPath, "ay-bc.js") });
|
||||||
|
|
||||||
//add stock helpers
|
//add stock helpers
|
||||||
await page.AddScriptTagAsync(new AddTagOptions() { Path = Path.Combine(ReportJSFolderPath, "sock-report.js") });
|
await page.AddScriptTagAsync(new AddTagOptions() { Path = Path.Combine(ReportJSFolderPath, "ay-report.js") });
|
||||||
|
|
||||||
//execute to add to handlebars
|
//execute to add to handlebars
|
||||||
await page.EvaluateExpressionAsync("ayRegisterHelpers();");
|
await page.EvaluateExpressionAsync("ayRegisterHelpers();");
|
||||||
|
|||||||
@@ -66,11 +66,12 @@ namespace Sockeye.Biz
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//GET
|
//GET
|
||||||
//
|
//
|
||||||
internal async Task<Subscription> GetAsync(long id, bool logTheGetEvent = true, bool populateForReporting = false)
|
internal async Task<Subscription> GetAsync(long id, bool logTheGetEvent = true)
|
||||||
{
|
{
|
||||||
var ret = await ct.Subscription.Include(z => z.Items.OrderByDescending(x=>x.Active).ThenBy(x => x.ExpireDate)).AsNoTracking().SingleOrDefaultAsync(z => z.Id == id);
|
var ret = await ct.Subscription.Include(z => z.Items.OrderByDescending(x => x.Active).ThenBy(x => x.ExpireDate)).AsNoTracking().SingleOrDefaultAsync(z => z.Id == id);
|
||||||
if (logTheGetEvent && ret != null)
|
if (logTheGetEvent && ret != null)
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, id, BizType, SockEvent.Retrieved), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, id, BizType, SockEvent.Retrieved), ct);
|
||||||
|
|
||||||
await PopulateVizFields(ret);
|
await PopulateVizFields(ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -236,6 +237,20 @@ namespace Sockeye.Biz
|
|||||||
await Task.CompletedTask;
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
internal async Task<Subscription> SubscriptionGetForReportingAsync(SockType sType, long id)
|
||||||
|
{
|
||||||
|
|
||||||
|
//if it's the entire workorder just get, populate and return as normal
|
||||||
|
if (sType == SockType.Subscription)
|
||||||
|
return await GetAsync(id, false);
|
||||||
|
var subId = await ct.SubscriptionItem.AsNoTracking().Where(z => z.Id == id).Select(z => z.SubscriptionId).FirstOrDefaultAsync();
|
||||||
|
return await GetAsync(subId, false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//REPORTING
|
//REPORTING
|
||||||
@@ -244,13 +259,19 @@ namespace Sockeye.Biz
|
|||||||
{
|
{
|
||||||
var idList = dataListSelectedRequest.SelectedRowIds;
|
var idList = dataListSelectedRequest.SelectedRowIds;
|
||||||
JArray ReportData = new JArray();
|
JArray ReportData = new JArray();
|
||||||
|
List<Subscription> batchResults = new List<Subscription>();
|
||||||
while (idList.Any())
|
while (idList.Any())
|
||||||
{
|
{
|
||||||
|
if (!ReportRenderManager.KeepGoing(jobId)) return null;
|
||||||
|
|
||||||
var batch = idList.Take(IReportAbleObject.REPORT_DATA_BATCH_SIZE);
|
var batch = idList.Take(IReportAbleObject.REPORT_DATA_BATCH_SIZE);
|
||||||
idList = idList.Skip(IReportAbleObject.REPORT_DATA_BATCH_SIZE).ToArray();
|
idList = idList.Skip(IReportAbleObject.REPORT_DATA_BATCH_SIZE).ToArray();
|
||||||
|
batchResults.Clear();
|
||||||
//query for this batch, comes back in db natural order unfortunately
|
foreach (long batchId in batch)
|
||||||
var batchResults = await ct.Subscription.AsNoTracking().Where(z => batch.Contains(z.Id)).ToArrayAsync();
|
{
|
||||||
|
if (!ReportRenderManager.KeepGoing(jobId)) return null;
|
||||||
|
batchResults.Add(await SubscriptionGetForReportingAsync(dataListSelectedRequest.SockType, batchId));
|
||||||
|
}
|
||||||
|
|
||||||
//order the results back into original
|
//order the results back into original
|
||||||
//What is happening here:
|
//What is happening here:
|
||||||
@@ -265,7 +286,6 @@ namespace Sockeye.Biz
|
|||||||
foreach (Subscription w in orderedList)
|
foreach (Subscription w in orderedList)
|
||||||
{
|
{
|
||||||
if (!ReportRenderManager.KeepGoing(jobId)) return null;
|
if (!ReportRenderManager.KeepGoing(jobId)) return null;
|
||||||
await PopulateVizFields(w);
|
|
||||||
var jo = JObject.FromObject(w);
|
var jo = JObject.FromObject(w);
|
||||||
if (!JsonUtil.JTokenIsNullOrEmpty(jo["CustomFields"]))
|
if (!JsonUtil.JTokenIsNullOrEmpty(jo["CustomFields"]))
|
||||||
jo["CustomFields"] = JObject.Parse((string)jo["CustomFields"]);
|
jo["CustomFields"] = JObject.Parse((string)jo["CustomFields"]);
|
||||||
|
|||||||
Reference in New Issue
Block a user