Commit 8a646b07 authored by HERBERT Ryan's avatar HERBERT Ryan
Browse files

controllers/run.py admin new run

Fixed an issue with the add run controller for admins that was producing
server errors
parent b0084e28
......@@ -178,23 +178,25 @@ def add():
distinct=True
)
max_group = db.auth_group[auth.user_group()]
log.debug(max_group)
groups = []
if (auth.is_admin()):
groups = db(db.auth_group).select(db.auth_group.id, db.auth_group.role)
group_list = db(db.auth_group).select(db.auth_group.id, db.auth_group.role)
else:
groups = [{'name': 'Personnal Group', 'id': auth.user_group()}]
groups.append({'name': 'Personnal Group', 'id': auth.user_group()})
group_list = auth.get_user_group_parents()
max_elements = 0
max_group = auth.user_group()
for group in group_list:
groups.append({'id': group.id, 'name': group.role})
elements = db(
(db.auth_permission.group_id == group.id) &
(db.auth_permission.table_name.belongs('patient', 'run', 'sample_set')) &
(db.auth_permission.record_id > 0)
).count()
if (elements > max_elements):
max_elements = elements
max_group = group.id
max_elements = 0
for group in group_list:
groups.append({'id': group.id, 'name': group.role})
elements = db(
(db.auth_permission.group_id == group.id) &
(db.auth_permission.table_name.belongs('patient', 'run', 'sample_set')) &
(db.auth_permission.record_id > 0)
).count()
if (elements > max_elements):
max_elements = elements
max_group = group.id
return dict(message=T('add run'),
sequencer_list = sequencer_list,
......
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