mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-14 16:55:42 +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:
|
||||
print('Job does not belong to current user.')
|
||||
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 = {}
|
||||
for file in os.listdir(input_dir):
|
||||
dir = os.path.join(current_app.config['OPAQUE_STORAGE'],
|
||||
str(current_user.id),
|
||||
'jobs',
|
||||
str(job.id))
|
||||
files = {}
|
||||
for file in os.listdir(dir):
|
||||
if file == 'output':
|
||||
continue
|
||||
input_files[file] = os.path.join(input_dir, file)
|
||||
|
||||
output_files = {}
|
||||
if job.status == 'complete':
|
||||
for input_file in input_files:
|
||||
dir = os.path.join(output_dir, input_file)
|
||||
for output_file in os.listdir(dir):
|
||||
output_files[output_file] = os.path.join(dir, output_file)
|
||||
files[file] = {}
|
||||
files[file]['path'] = os.path.join(dir, file)
|
||||
if job.status == 'complete':
|
||||
files[file]['results'] = {}
|
||||
results_dir = os.path.join(dir, 'output', file)
|
||||
for result in os.listdir(results_dir):
|
||||
files[file]['results'][result] = {}
|
||||
files[file]['results'][result]['path'] = os.path.join(
|
||||
results_dir, result
|
||||
)
|
||||
|
||||
return render_template('main/jobs/job.html.j2',
|
||||
input_files=input_files,
|
||||
files=files,
|
||||
job=job,
|
||||
output_files=output_files, title='Job')
|
||||
title='Job')
|
||||
|
@ -71,23 +71,26 @@
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
{% for file in input_files %}
|
||||
<a href="file://{{ input_files[file] }}" class="waves-effect waves-light btn-small">
|
||||
{% for file in files %}
|
||||
<a href="file://{{ files[file]['path'] }}" class="waves-effect waves-light btn-small">
|
||||
<i class="material-icons left">file_download</i>{{ file }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</p>
|
||||
|
||||
{% if job.status == 'complete' %}
|
||||
<p> </p>
|
||||
|
||||
<span class="card-title">Results</span>
|
||||
<p>
|
||||
{% for file in output_files %}
|
||||
<a href="file://{{ output_files[file] }}" class="waves-effect waves-light btn-small">
|
||||
<i class="material-icons left">file_download</i>{{ file }}
|
||||
</a>
|
||||
{% for file in files %}
|
||||
{% for result in files[file]['results'] %}
|
||||
<a href="file://{{ files[file]['results'][result]['path'] }}" class="waves-effect waves-light btn-small">
|
||||
<i class="material-icons left">file_download</i>{{ result }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user