Skip to content

Commit

Permalink
Don't display compositions without an active_agent
Browse files Browse the repository at this point in the history
  • Loading branch information
ngiger committed Sep 1, 2015
1 parent af5b79d commit a825bd4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
10 changes: 6 additions & 4 deletions src/view/additional_information.rb
Expand Up @@ -133,13 +133,15 @@ def compositions(model, session=@session)
if galform = comp.galenic_form and galform.respond_to?(lang.to_sym)
part << galform.send(lang).to_s << ': '
end
if comp.active_agents.size > 1
part << @lookandfeel.lookup(:active_agents, comp.active_agents.size)
else
if comp.active_agents.size == 0
nil # dont't add a part
elsif comp.active_agents.size == 1
part << comp.active_agents.first.to_s
else
part << @lookandfeel.lookup(:active_agents, comp.active_agents.size)
end
}
link.value = parts.join('<br/>')
link.value = parts.find_all{|x| x != nil}.join('<br/>')
link
end
def ddd_price(model, session=@session)
Expand Down
9 changes: 5 additions & 4 deletions src/view/drugs/resultlist.rb
Expand Up @@ -273,7 +273,6 @@ def mail_order_price(model, session=@session)
def active_agents(model, session=@session)
link = HtmlGrid::Link.new(:show, model, session, self)
link.href = @lookandfeel._event_url(:show, {:pointer => model.pointer})
$stdout.puts "result_list active_agents #{model.class}"
if model.active_agents.size > 1
link.set_attribute('title', model.active_agents.join(', '))
link.value = @lookandfeel.lookup(:active_agents, model.active_agents.size)
Expand Down Expand Up @@ -387,12 +386,14 @@ def substances(model, session=@session)
else
link.href = @lookandfeel._event_url(:show, {:pointer => model.pointer})
end
if (model.active_agents.size > 1)
if (model.active_agents.size == 0)
return nil
elsif (model.active_agents.size == 1)
link.value = model.substances.first.to_s
else
#txt = HtmlGrid::Component.new(model, session, self)
link.set_attribute('title', model.active_agents.join(', '))
link.value = @lookandfeel.lookup(:active_agents, model.active_agents.size)
else
link.value = model.substances.first.to_s
end
link
end
Expand Down

0 comments on commit a825bd4

Please sign in to comment.