mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-24 10:34:17 +00:00
Only use one file list.
This commit is contained in:
parent
759a29362c
commit
e00d34ef81
@ -71,30 +71,27 @@ def job(job_id):
|
|||||||
elif not job.user_id == current_user.id:
|
elif not job.user_id == current_user.id:
|
||||||
print('Job does not belong to current user.')
|
print('Job does not belong to current user.')
|
||||||
abort(403)
|
abort(403)
|
||||||
input_dir = os.path.join(current_app.config['OPAQUE_STORAGE'],
|
|
||||||
str(current_user.id),
|
|
||||||
'jobs',
|
|
||||||
str(job.id))
|
|
||||||
output_dir = os.path.join(current_app.config['OPAQUE_STORAGE'],
|
|
||||||
str(current_user.id),
|
|
||||||
'jobs',
|
|
||||||
str(job.id),
|
|
||||||
'output')
|
|
||||||
|
|
||||||
input_files = {}
|
dir = os.path.join(current_app.config['OPAQUE_STORAGE'],
|
||||||
for file in os.listdir(input_dir):
|
str(current_user.id),
|
||||||
|
'jobs',
|
||||||
|
str(job.id))
|
||||||
|
files = {}
|
||||||
|
for file in os.listdir(dir):
|
||||||
if file == 'output':
|
if file == 'output':
|
||||||
continue
|
continue
|
||||||
input_files[file] = os.path.join(input_dir, file)
|
files[file] = {}
|
||||||
|
files[file]['path'] = os.path.join(dir, file)
|
||||||
output_files = {}
|
if job.status == 'complete':
|
||||||
if job.status == 'complete':
|
files[file]['results'] = {}
|
||||||
for input_file in input_files:
|
results_dir = os.path.join(dir, 'output', file)
|
||||||
dir = os.path.join(output_dir, input_file)
|
for result in os.listdir(results_dir):
|
||||||
for output_file in os.listdir(dir):
|
files[file]['results'][result] = {}
|
||||||
output_files[output_file] = os.path.join(dir, output_file)
|
files[file]['results'][result]['path'] = os.path.join(
|
||||||
|
results_dir, result
|
||||||
|
)
|
||||||
|
|
||||||
return render_template('main/jobs/job.html.j2',
|
return render_template('main/jobs/job.html.j2',
|
||||||
input_files=input_files,
|
files=files,
|
||||||
job=job,
|
job=job,
|
||||||
output_files=output_files, title='Job')
|
title='Job')
|
||||||
|
@ -71,23 +71,26 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<p>
|
||||||
{% for file in input_files %}
|
{% for file in files %}
|
||||||
<a href="file://{{ input_files[file] }}" class="waves-effect waves-light btn-small">
|
<a href="file://{{ files[file]['path'] }}" class="waves-effect waves-light btn-small">
|
||||||
<i class="material-icons left">file_download</i>{{ file }}
|
<i class="material-icons left">file_download</i>{{ file }}
|
||||||
</a>
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
{% if job.status == 'complete' %}
|
||||||
<p> </p>
|
<p> </p>
|
||||||
|
|
||||||
<span class="card-title">Results</span>
|
<span class="card-title">Results</span>
|
||||||
<p>
|
<p>
|
||||||
{% for file in output_files %}
|
{% for file in files %}
|
||||||
<a href="file://{{ output_files[file] }}" class="waves-effect waves-light btn-small">
|
{% for result in files[file]['results'] %}
|
||||||
<i class="material-icons left">file_download</i>{{ file }}
|
<a href="file://{{ files[file]['results'][result]['path'] }}" class="waves-effect waves-light btn-small">
|
||||||
</a>
|
<i class="material-icons left">file_download</i>{{ result }}
|
||||||
|
</a>
|
||||||
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</p>
|
</p>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user