Commit e6eaa03e authored by Ryan Herbert's avatar Ryan Herbert
Browse files

file.py file forms, add all invovled groups to group_ids for tags

Samples had not been updated to include multiple groups, this commit not
only served to fix this, but also takes the opportunity to include all
the involved groups when auto-completing samples
parent a364bcda
......@@ -57,17 +57,18 @@ def add():
patient_id = None
run_id = None
generic_id = None
group_id = None
group_ids = []
if sample_set.sample_type == defs.SET_TYPE_GENERIC:
generic_id = db( db.generic.sample_set_id == request.vars["id"]).select()[0].id
group_id = get_set_group(sample_set.sample_type, generic_id)
group_ids.append(get_set_group(sample_set.sample_type, generic_id))
if sample_set.sample_type == defs.SET_TYPE_PATIENT:
patient_id = db( db.patient.sample_set_id == request.vars["id"]).select()[0].id
group_id = get_set_group(sample_set.sample_type, patient_id)
group_ids.append(get_set_group(sample_set.sample_type, patient_id))
if sample_set.sample_type == defs.SET_TYPE_RUN:
run_id = db( db.run.sample_set_id == request.vars["id"]).select()[0].id
group_id = get_set_group(sample_set.sample_type, run_id)
group_ids.append(get_set_group(sample_set.sample_type, run_id))
group_ids = [int(gid) for gid in group_ids]
query_pre_process = db(
db.pre_process>0
......@@ -103,7 +104,7 @@ def add():
sample_type = sample_set.sample_type,
run = run,
source_module_active = source_module_active,
group_id = group_id)
group_ids = group_ids)
def manage_filename(filename):
filepath = ""
......@@ -282,11 +283,12 @@ def edit():
patient_list, patient = get_sample_set_list(defs.SET_TYPE_PATIENT, relevant_ids['patient'])
run_list, run = get_sample_set_list(defs.SET_TYPE_RUN, relevant_ids['run'])
group_id = None
group_ids = []
for key in relevant_ids:
if (relevant_ids[key] is not None):
group_id = get_set_group(key, relevant_ids[key])
break
group_ids.append(get_set_group(key, relevant_ids[key]))
group_ids = [int(gid) for gid in group_ids]
source_module_active = hasattr(defs, 'FILE_SOURCE') and hasattr(defs, 'FILE_TYPES')
return dict(message = T('edit file'),
......@@ -300,7 +302,7 @@ def edit():
file = db.sequence_file[request.vars["id"]],
sample_type = request.vars['sample_type'],
source_module_active = source_module_active,
group_id = group_id)
group_ids = group_ids)
else:
return error_message("you need admin permission to edit files")
......
......@@ -90,7 +90,7 @@
</tr>
<tr>
<td><label for="file_info" id="file_info__label">info: </label></td>
<td><textarea onfocus="new VidjilAutoComplete().setupAtWho(this);" data-needs-atwho="true" data-group-id="{{=group_id}}" class="text" id="file_info" name="file_info" cols="60" rows="8"></textarea></td>
<td><textarea onfocus="new VidjilAutoComplete().setupAtWho(this);" data-needs-atwho="true" data-group-ids="{{=group_ids}}" class="text" id="file_info" name="file_info" cols="60" rows="8"></textarea></td>
<td></td>
</tr>
<tr>
......
......@@ -98,7 +98,7 @@ info = db.sequence_file[request.vars["id"]]
</tr>
<tr>
<td><label for="file_info" id="file_info__label">info: </label></td>
<td><textarea onfocus="new VidjilAutoComplete().setupAtWho(this);" data-needs-atwho="true" data-group-id="{{=group_id}}" class="text" id="file_info" name="file_info" cols="60" rows="12">{{=file.info}}</textarea></td>
<td><textarea onfocus="new VidjilAutoComplete().setupAtWho(this);" data-needs-atwho="true" data-group-ids="{{=group_ids}}" class="text" id="file_info" name="file_info" cols="60" rows="12">{{=file.info}}</textarea></td>
<td></td>
</tr>
<tr>
......
Supports Markdown
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