Commit 7e097da7 authored by Mathieu Giraud's avatar Mathieu Giraud

Merge branch 'prod-server' into 'dev'

Faster patient list loading

Closes #3139, #3141, #3169, and #2525

See merge request !187
parents f25492ca 81aac836
Pipeline #22293 failed with stages
in 46 seconds
...@@ -38,7 +38,7 @@ def home(): ...@@ -38,7 +38,7 @@ def home():
if auth.is_admin(): if auth.is_admin():
redirect = URL('admin', 'index', scheme=True, host=True) redirect = URL('admin', 'index', scheme=True, host=True)
else: else:
redirect = URL('sample_set', 'all', vars={'type': defs.SET_TYPE_PATIENT}, scheme=True, host=True) redirect = URL('sample_set', 'all', vars={'type': defs.SET_TYPE_PATIENT, 'page': 0}, scheme=True, host=True)
res = {"redirect" : redirect} res = {"redirect" : redirect}
return gluon.contrib.simplejson.dumps(res, separators=(',',':')) return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......
...@@ -146,17 +146,18 @@ def index(): ...@@ -146,17 +146,18 @@ def index():
## return a list of generic sample_sets ## return a list of generic sample_sets
def all(): def all():
start = time.time() start = time.time()
if request.vars['type']:
type = request.vars['type']
else :
type = defs.SET_TYPE_GENERIC
if not auth.user : if not auth.user :
res = {"redirect" : URL('default', 'user', args='login', scheme=True, host=True, res = {"redirect" : URL('default', 'user', args='login', scheme=True, host=True,
vars=dict(_next=URL('sample_set', 'all', vars={'type': defs.SET_TYPE_PATIENT}, scheme=True, host=True))) vars=dict(_next=URL('sample_set', 'all', vars={'type': type, 'page': 0}, scheme=True, host=True)))
} }
return gluon.contrib.simplejson.dumps(res, separators=(',',':')) return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
isAdmin = auth.is_admin() isAdmin = auth.is_admin()
if request.vars['type']:
type = request.vars['type']
else :
type = defs.SET_TYPE_GENERIC
step = None step = None
page = None page = None
...@@ -515,7 +516,7 @@ def submit(): ...@@ -515,7 +516,7 @@ def submit():
"message": msg} "message": msg}
else: else:
res = {"redirect": "sample_set/all", res = {"redirect": "sample_set/all",
"args" : { "type" : length_mapping[max_num] }, "args" : { "type" : length_mapping[max_num], "page": 0 },
"message": msg} "message": msg}
return gluon.contrib.simplejson.dumps(res, separators=(',',':')) return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else: else:
...@@ -691,7 +692,7 @@ def delete(): ...@@ -691,7 +692,7 @@ def delete():
db(db.sample_set.id == sample_set.id).delete() db(db.sample_set.id == sample_set.id).delete()
res = {"redirect": "sample_set/all", res = {"redirect": "sample_set/all",
"args": {"type": sample_type}, "args": {"type": sample_type, "page": 0},
"success": "true", "success": "true",
"message": "sample set ("+str(request.vars["id"])+") deleted"} "message": "sample set ("+str(request.vars["id"])+") deleted"}
log.info(res, extra={'user_id': auth.user.id, 'record_id': request.vars["id"], 'table_name': 'sample_set'}) log.info(res, extra={'user_id': auth.user.id, 'record_id': request.vars["id"], 'table_name': 'sample_set'})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment