Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
vidjil
vidjil
Commits
116db4f4
Commit
116db4f4
authored
Mar 26, 2015
by
Marc Duez
Browse files
server : patient.py > TODO improve index(too many subquery)
parent
30a9412f
Changes
1
Hide whitespace changes
Inline
Side-by-side
server/web2py/applications/vidjil/controllers/patient.py
View file @
116db4f4
...
...
@@ -166,15 +166,16 @@ def index():
isAdmin
=
auth
.
has_membership
(
"admin"
)
##retrieve patient list
query
=
db
(
(
auth
.
accessible_query
(
'read'
,
db
.
patient
)
|
auth
.
accessible_query
(
'admin'
,
db
.
patient
)
)
(
auth
.
accessible_query
(
'read'
,
db
.
patient
)
|
auth
.
accessible_query
(
'admin'
,
db
.
patient
)
)
&
(
auth
.
accessible_query
(
'read'
,
db
.
config
)
|
auth
.
accessible_query
(
'admin'
,
db
.
config
)
)
).
select
(
db
.
patient
.
ALL
,
count
,
orderby
=
~
db
.
patient
.
id
,
left
=
db
.
sequence_file
.
on
(
db
.
patient
.
id
==
db
.
sequence_file
.
patient_id
),
left
=
[
db
.
sequence_file
.
on
(
db
.
patient
.
id
==
db
.
sequence_file
.
patient_id
),
db
.
config
.
on
(
db
.
fused_file
.
config_id
==
db
.
config
.
id
)],
groupby
=
db
.
patient
.
id
)
...
...
@@ -194,7 +195,8 @@ def index():
row
.
most_used_conf
=
-
1
if
len
(
query_conf
)
>
0
:
row
.
most_used_conf
=
query_conf
[
0
].
fused_file
.
config_id
##add groups info for each patient
row
.
groups
=
""
for
row3
in
db
(
...
...
@@ -210,7 +212,7 @@ def index():
for
row4
in
query_size
:
row
.
size
+=
row4
.
size_file
##sort result
reverse
=
False
if
request
.
vars
[
"reverse"
]
==
"true"
:
...
...
@@ -229,7 +231,7 @@ def index():
request
.
vars
[
"filter"
]
=
""
for
row
in
query
:
row
.
string
=
(
row
.
confs
+
row
.
groups
+
row
.
patient
.
last_name
+
row
.
patient
.
first_name
+
str
(
row
.
patient
.
birth
)).
lower
()
+
row
.
patient
.
info
row
.
string
=
(
row
.
confs
+
row
.
groups
+
row
.
patient
.
last_name
+
row
.
patient
.
first_name
+
str
(
row
.
patient
.
birth
)).
lower
()
+
str
(
row
.
patient
.
info
)
query
=
query
.
find
(
lambda
row
:
vidjil_utils
.
filter
(
row
.
string
,
request
.
vars
[
"filter"
])
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment