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