Fix timestamp inconsistency
This commit is contained in:
parent
d3673fc826
commit
ce0ea11a3b
@ -27,6 +27,7 @@ export const d_unwrap = data => {
|
||||
if(data.error) throw new RPCError(data.error.type, ...data.error.args);
|
||||
if(data.ts) try {
|
||||
data.result._ts = data.ts;
|
||||
if(data.cached) data.result._cached = data.cached;
|
||||
} catch(ex) {}
|
||||
return data.result;
|
||||
};
|
||||
@ -172,18 +173,18 @@ export const d_parse_notifications_fastuser = data => d_split(data, '^', 'info',
|
||||
|
||||
export const d_parse_multireport = data => {
|
||||
if(data.length < 1) return [];
|
||||
var brk, max = 0, grp;
|
||||
var brk, max = 0, grp, _ts = data._ts;
|
||||
for(var i = 0; i < data.length; ++i) {
|
||||
brk = (grp = data[i]).indexOf('^');
|
||||
if(brk >= 0) {
|
||||
grp = +grp.substring(0, brk);
|
||||
if(grp >= max) max = grp;
|
||||
else break;
|
||||
} else return [data];
|
||||
} else return (data = [data], data._ts = _ts, data);
|
||||
}
|
||||
var res = [], data = data.slice(), max = max + '^', grp = x => x.startsWith(max);
|
||||
while(((brk = data.findIndex(grp)) >= 0) || (brk = data.length)) res.push(data.splice(0, brk + 1));
|
||||
return res;
|
||||
return (res._ts = _ts, res);
|
||||
};
|
||||
|
||||
export const d_parse_tiudocumentlist = data => d_split(data, '^', 'IEN', 'title', 'time', 'patient', 'author', 'location', 'status', 'visit').map(row => {
|
||||
@ -322,6 +323,7 @@ export function Client(cid, secret) {
|
||||
this.ORWDX_LOADRSP = memoized(aflow((...args) => this.callctx(['OR CPRS GUI CHART'], 'ORWDX_LOADRSP', ...args), d_log, d_unwrap, orderoverrides_parse, f_key('promptID')));
|
||||
this.ORWDX_SAVE = aflow((...args) => this.call({ method: 'ORWDX_SAVE', context: ['OR CPRS GUI CHART'], ttl: 0, stale: false }, ...args), d_log, d_unwrap);
|
||||
this.ORWDXM_MENU = memoized(aflow((...args) => this.callctx(['OR CPRS GUI CHART'], 'ORWDXM_MENU', ...args), d_log, d_unwrap, d_parse_ordermenu));
|
||||
//this.ORWDXM_FORMID = memoized(aflow((...args) => this.callctx(['OR CPRS GUI CHART'], 'ORWDXM_FORMID', ...args), d_log, d_unwrap));
|
||||
this.ORWDXM_DLGNAME = memoized(aflow((...args) => this.callctx(['OR CPRS GUI CHART'], 'ORWDXM_DLGNAME', ...args), d_log, d_unwrap, f_split1('^', 'InternalName', 'DisplayName', 'BaseDialogIEN', 'BaseDialogName')));
|
||||
this.ORWDXM_PROMPTS = memoized(aflow((...args) => this.callctx(['OR CPRS GUI CHART'], 'ORWDXM_PROMPTS', ...args), d_log, d_unwrap, f_parse_caretseparated_detail(['id', 'req', 'hid', 'prompt', 'type', 'domain', 'default', 'idflt', 'help']), f_key('id')));
|
||||
this.ORWDXM1_BLDQRSP = aflow((...args) => this.call({ method: 'ORWDXM1_BLDQRSP', context: ['OR CPRS GUI CHART'], ttl: 0, stale: false }, ...args), d_log, d_unwrap, f_split('^', 'QuickLevel', 'ResponseID', 'Dialog', 'Type', 'FormID', 'DGrpLST'));
|
||||
|
3
main.py
3
main.py
@ -3,6 +3,7 @@
|
||||
import json
|
||||
import secrets
|
||||
import string
|
||||
import time
|
||||
from flask import Flask, request, send_from_directory
|
||||
from flask.json import jsonify
|
||||
from flask.json.provider import DefaultJSONProvider
|
||||
@ -39,7 +40,7 @@ class CacheProxyRPC(util.CacheProxy):
|
||||
self._cache(('SDEC_RESOURCE', 'ORWU1_NEWLOC', 'ORWLRR_ALLTESTS_ALL', 'ORWORDG_ALLTREE', 'ORWORDG_REVSTS', 'ORWDX_DGNM', 'ORWDX_ORDITM'), persistent, prefix=prefix, ttl=float('inf'))
|
||||
|
||||
def jsonify_result(value, id=None):
|
||||
return jsonify({ 'result': value._base, 'error': None, 'id': request.json.get('id'), 'ts': value._ts } if isinstance(value, util.Cached) else { 'result': value, 'error': None, 'id': request.json.get('id') })
|
||||
return jsonify({ 'result': value._base, 'error': None, 'id': request.json.get('id'), 'ts': value._ts, 'cached': True } if isinstance(value, util.Cached) else { 'result': value, 'error': None, 'id': request.json.get('id'), 'ts': time.time() })
|
||||
|
||||
def jsonify_error(ex, id=None):
|
||||
return jsonify({ 'result': None, 'error': { 'type': ex.__class__.__name__, 'args': ex.args }, 'id': id })
|
||||
|
Loading…
Reference in New Issue
Block a user