Commit 18cb74b4 authored by Ryan Herbert's avatar Ryan Herbert
Browse files

my account jobs: add sample set name

parent ad042c57
......@@ -241,22 +241,42 @@ def jobs():
if (tags is not None and len(tags) > 0):
query = (query & filter_by_tags(tags))
result = db(query).select(
db.sample_set.id.with_alias('sample_set_id'),
db.sample_set.sample_type.with_alias('sample_type'),
db.sequence_file.filename.with_alias('filename'),
db.sequence_file.info.with_alias('info'),
db.config.id.with_alias('config_id'),
db.config.name.with_alias('config'),
db.scheduler_task.status.with_alias('status'),
db.scheduler_task.start_time.with_alias('time'),
orderby=~db.scheduler_task.start_time
)
names = {}
names['patient'] = "patient.first_name || ' ' || patient.last_name"
names['run'] = "run.name"
names['generic'] = "generic.name"
queries = {}
for set_type in ['patient', 'run', 'generic']:
set_query = (query &
(db[set_type].sample_set_id == db.sample_set.id))
key = 'set' if set_type == 'generic' else set_type
queries[key] = db(set_query).select(
names[set_type],
db.sample_set.id.with_alias('sample_set_id'),
db.sample_set.sample_type.with_alias('sample_type'),
db.sequence_file.filename.with_alias('filename'),
db.sequence_file.info.with_alias('info'),
db.config.id.with_alias('config_id'),
db.config.name.with_alias('config'),
db.scheduler_task.status.with_alias('status'),
db.scheduler_task.start_time.with_alias('time'),
orderby=~db.scheduler_task.start_time
)
involved_group_ids = get_involved_groups() # for search autocomplete
tagdecorator = TagDecorator(get_tag_prefix())
result = []
for key in queries:
result += queries[key]
sorted_start = time.time()
result = sorted(result, key=lambda x: x.time, reverse=True)
log.debug("jobs list sort (%.3fs)" % (time.time() - sorted_start))
return dict(result=result,
group_ids = group_list,
involved_group_ids = involved_group_ids,
tagdecorator = tagdecorator)
tagdecorator = tagdecorator,
names = names)
......@@ -14,6 +14,7 @@
<thead>
<tr>
<td class="column4"></td>
<td>name</td>
<td>filename</td>
<td>info</td>
<td class="column2">config</td>
......@@ -24,6 +25,13 @@
{{ for row in result: }}
<tr>
<td class="uid"><span class="{{=row.sample_type}}_token">{{=row.sample_set_id}}</span></td>
{{ if row.sample_type == 'patient': }}
{{split_name = row._extra[names['patient']].split(' ')}}
{{ name = vidjil_utils.display_names(row.sample_set_id, split_name[0], split_name[1]) }}
{{ else: }}
{{ name = row[row.sample_type].name }}
{{pass}}
<td>{{=name}}</td>
<td>{{=row.filename}}</td>
{{ info = tagdecorator.decorate(row.info, 'tag', 'sequence_file', '/my_account/jobs') }}
<td>{{=tagdecorator.sanitize(info)}}</td>
......
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