Fix no step bug

This commit is contained in:
Mojca Lorber 2020-10-22 13:21:05 +02:00
parent 6d7b55301f
commit 2639810e1a
2 changed files with 3 additions and 3 deletions

View file

@ -364,8 +364,8 @@ class Protocol < ApplicationRecord
steps.where(completed: true)
end
def first_step
steps.find_by(position: 0)
def first_step_id
steps.find_by(position: 0)&.id
end
def space_taken

View file

@ -6,7 +6,7 @@
<div class="open-mobile-app-buttons">
<a type="button"
class="btn btn-dark-background btn-large"
href="<%= pwa_mobile_app_url(@current_team.id, @project.id, @experiment.id, @my_module.id, @protocol.id, @protocol.first_step.id, request.host) %>">
href="<%= pwa_mobile_app_url(@current_team.id, @project.id, @experiment.id, @my_module.id, @protocol.id, @protocol.first_step_id, request.host) %>">
<i class="fas fa-mobile-alt"></i>
<%= t('my_modules.open_mobile_app.open_mobile_app') %>
</a>