Skip to content

Commit

Permalink
sample_set.py, sample_set/custom.html fix issues with helper instance
Browse files Browse the repository at this point in the history
there were a couple issues with calls to in non-existant helper
instance, so now we have an instance to work with
  • Loading branch information
RyanHerb committed Sep 7, 2017
1 parent 277b72a commit 8a2b182
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion server/web2py/applications/vidjil/controllers/sample_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,11 @@ def custom():
request.vars["custom_list"] = [request.vars["custom_list"]]

myGroupBy = None
helper = None
if request.vars["id"] and auth.can_view_sample_set(request.vars["id"]):
sample_set = db.sample_set[request.vars["id"]]
factory = ModelFactory()
helper = factory.get_instance(type=sample_set.sample_type)
q = ((auth.vidjil_accessible_query(PermissionEnum.read_config.value, db.config))
& (db.sample_set.id == request.vars["id"])
& (db.sample_set_membership.sample_set_id == db.sample_set.id)
Expand Down Expand Up @@ -403,7 +407,8 @@ def custom():

return dict(query=query,
config_id=config_id,
config=config)
config=config,
helper=helper)

def confirm():
if auth.can_modify_sample_set(request.vars["id"]):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<div>

{{ if request.vars['id']: }}
<h3>Compare samples from {{=helper.get_type_display()}} {{=helper.get_name(request.vars['id'])}}</h3>
<h3>Compare samples from {{=helper.get_type_display()}} {{=get_sample_name(request.vars["id"])}}</h3>
{{ else: }}
<h3>Compare samples</h3>
{{pass}}
Expand Down Expand Up @@ -50,7 +50,7 @@ <h3>Compare samples</h3>
<table class="db_table table_compare" id="table">
<thead>
<tr><td class="column5"> </td>
<td class="column_200"> {{=helper.get_type_display()}} </td>
<td class="column_200"> {{=helper.get_type_display() if helper is not None else "name"}} </td>
<td class="column_200"> file name </td>
<td class="column_100"> sampling date </td>
<td> info </td>
Expand Down

0 comments on commit 8a2b182

Please sign in to comment.