Commit d23dc80e authored by Marc Duez's avatar Marc Duez

server : store filename for sequence file // use stored filename instead of retrieve() function

parent c74a7ce5
......@@ -104,7 +104,7 @@ def get_data():
data["samples"]["original_names"] = []
data["samples"]["info"] = []
for row in query :
(filename, str) = db.sequence_file.data_file.retrieve(row.sequence_file.data_file)
filename = row.sequence_file.filename
data["samples"]["original_names"].append(filename)
data["samples"]["info"].append(row.sequence_file.info)
......
......@@ -32,11 +32,7 @@ def add_form():
if error=="" :
query = db((db.sequence_file.patient_id==request.vars['patient_id'])).select()
for row in query :
if row.data_file is None :
filename= " "
else:
(filename, str) = db.sequence_file.data_file.retrieve(row.data_file)
if filename == request.vars['filename'] :
if row.filename == request.vars['filename'] :
res = {"message": "this sequence file already exists for this patient"}
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......@@ -45,13 +41,15 @@ def add_form():
pcr=request.vars['pcr'],
sequencer=request.vars['sequencer'],
producer=request.vars['producer'],
patient_id=request.vars['patient_id'])
patient_id=request.vars['patient_id'],
filename=request.vars['filename'])
res = {"file_id" : id,
"message": request.vars['filename'] + ": upload started",
"redirect": "patient/info",
"args" : {"id" : request.vars['patient_id']}
}
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else :
......@@ -84,11 +82,7 @@ def edit_form():
if error=="" :
query = db((db.sequence_file.patient_id==db.sequence_file[request.vars['id']].patient_id)).select()
for row in query :
if row.data_file is None :
filename = " "
else:
(filename, str) = db.sequence_file.data_file.retrieve(row.data_file)
if filename == request.vars['filename'] :
if row.filename == request.vars['filename'] :
res = {"message": "this sequence file already exists for this patient"}
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......
......@@ -31,19 +31,13 @@ query = db(
{{for row in query :}}
{{if row.sequence_file.data_file is None :}}
{{filename = ''}}
{{else:}}
{{(filename, str) = db.sequence_file.data_file.retrieve(row.sequence_file.data_file)}}
{{pass}}
{{if row.data_file.scheduler_task_id is None :}}
{{status = '' }}
{{else:}}
{{status = db.scheduler_task[row.data_file.scheduler_task_id ].status }}
{{pass}}
<tr>
<td> {{=filename}} </td>
<td> {{=row.sequence_file.filename}} </td>
<td> {{=row.config.name}} </td>
<td></td>
<td> {{=row.patient.last_name + " " + row.patient.first_name }} </td>
......
......@@ -95,13 +95,6 @@ query = db(
</thead>
<tbody>
{{for row in query :}}
{{if row.sequence_file.data_file is None :}}
{{filename = ''}}
{{else:}}
{{(filename, str) = db.sequence_file.data_file.retrieve(row.sequence_file.data_file)}}
{{pass}}
{{if row.data_file.scheduler_task_id is None :}}
{{status = '' }}
{{else:}}
......@@ -109,9 +102,8 @@ query = db(
{{pass}}
<tr>
<td id="sequence_file_{{=row.sequence_file.id}}"> {{=filename}}</td>
<td> {{if filename == 'plop':}}<a href="{{=URL('patient','download', scheme='https', args=row.sequence_file.data_file)}}" >dl</a>{{pass}}</td>
<td id="sequence_file_{{=row.sequence_file.id}}"> {{=row.sequence_file.filename}}</td>
<td> {{if row.sequence_file.filename == 'plop':}}<a href="{{=URL('patient','download', scheme='https', args=row.sequence_file.data_file)}}" >dl</a>{{pass}}</td>
<td> {{=row.sequence_file.sampling_date}} </td>
<td> {{=row.sequence_file.info}} </td>
{{if (auth.has_permission('admin', 'patient', request.vars["id"]) ):}}
......
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