Fix report viewer early truncation of loading

This commit is contained in:
Jiang Yio 2023-05-16 23:25:21 -04:00
parent c74855b9c2
commit b74dcb7d24

View File

@ -357,9 +357,10 @@
} }
var dfn = this.patient_dfn, resultsets = this.resultsets, resultset, reports = this.reports, report, alpha = strftime_vista(this.date_begin).toFixed(4), omega = strftime_vista(this.date_end).toFixed(4); var dfn = this.patient_dfn, resultsets = this.resultsets, resultset, reports = this.reports, report, alpha = strftime_vista(this.date_begin).toFixed(4), omega = strftime_vista(this.date_end).toFixed(4);
for(var i = 0; i < reports.length; ++i) if(((report = reports[i]).enabled) && (!((resultset = resultsets[i]) && (alpha == resultset.alpha) && (omega == resultset.omega)))) { for(var i = 0; i < reports.length; ++i) if(((report = reports[i]).enabled) && (!((resultset = resultsets[i]) && (alpha == resultset.alpha) && (omega == resultset.omega)))) {
var data = [], batch, idmap = {}, omega0 = omega; var data = [], batch, count, idmap = {}, omega0 = omega;
do { do {
batch = await this.client.ORWRP_REPORT_TEXT(dfn, report.rpt_id + (report.rpt_id.endsWith(';') ? SZ_WINDOW : ''), '', SZ_RANGE, '', alpha, omega0); batch = await this.client.ORWRP_REPORT_TEXT(dfn, report.rpt_id + (report.rpt_id.endsWith(';') ? SZ_WINDOW : ''), '', SZ_RANGE, '', alpha, omega0);
count = batch.length;
if(report.singleton) data = [report.map(batch[0].join('\n'))]; if(report.singleton) data = [report.map(batch[0].join('\n'))];
else if((batch = batch.map(item => { else if((batch = batch.map(item => {
var res = [], line, brk, sub; var res = [], line, brk, sub;
@ -378,7 +379,7 @@
batch.map(x => x.id).reduce((acc, val) => (acc[val] = true, acc), idmap); batch.map(x => x.id).reduce((acc, val) => (acc[val] = true, acc), idmap);
omega0 = strftime_vista(data[data.length - 1].time); omega0 = strftime_vista(data[data.length - 1].time);
}; };
} while(batch.length >= SZ_WINDOW); } while(count >= SZ_WINDOW);
data.alpha = alpha; data.alpha = alpha;
data.omega = omega; data.omega = omega;
resultsets[i] = data; resultsets[i] = data;