Skip to content

Commit

Permalink
Make RuboCop happy
Browse files Browse the repository at this point in the history
  • Loading branch information
JanCBrammer committed Aug 10, 2023
1 parent 1efcca5 commit f6183d6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions app/api/chemotion/reaction_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class ReactionAPI < Grape::API
optional :duration, type: String
optional :rxno, type: String
optional :segments, type: Array
optional :variations, type: Array[Hash]
optional :variations, type: [Hash]
end
route_param :id do
after_validation do
Expand Down Expand Up @@ -221,7 +221,7 @@ class ReactionAPI < Grape::API
requires :container, type: Hash
optional :duration, type: String
optional :rxno, type: String
optional :variations, type: Array[Hash]
optional :variations, type: [Hash]
end

post do
Expand Down
2 changes: 1 addition & 1 deletion app/api/entities/reaction_variation_entity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ReactionVariationEntity < ApplicationEntity
def properties
{}.tap do |properties|
properties[:temperature] = ReactionVariationPropertyEntity.represent(object[:properties][:temperature])
properties[:duration] = ReactionVariationPropertyEntity.represent(object[:properties][:duration])
properties[:duration] = ReactionVariationPropertyEntity.represent(object[:properties][:duration])
end
end

Expand Down
14 changes: 7 additions & 7 deletions lib/reporter/docx/detail_reaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,24 @@ def content
gp_title_html: gp_title_html,
synthesis_title_html: synthesis_title_html,
synthesis_html: synthesis_html,
variations: variations
variations: variations,
}
end

private

def variations
obj.variations.map do |variation|
obj.variations.map do |var|
{
'temperature' => "#{variation['properties']['temperature']['value']} #{variation['properties']['temperature']['unit']}",
'duration' => "#{variation['properties']['duration']['value']} #{variation['properties']['duration']['unit']}",
'startingMaterials' => variation['startingMaterials'].map do |_, v|
'temperature' => "#{var['properties']['temperature']['value']} #{var['properties']['temperature']['unit']}",
'duration' => "#{var['properties']['duration']['value']} #{var['properties']['duration']['unit']}",
'startingMaterials' => var['startingMaterials'].map do |_, v|
"#{v['aux']['sumFormula']}:\n#{v['value']} #{v['unit']}" + (v['aux']['isReference'] ? '; Ref' : '')
end,
'reactants' => variation['reactants'].map do |_, v|
'reactants' => var['reactants'].map do |_, v|
"#{v['aux']['sumFormula']}:\n#{v['value']} #{v['unit']}" + (v['aux']['isReference'] ? '; Ref' : '')
end,
'products' => variation['products'].map do |_, v|
'products' => var['products'].map do |_, v|
"#{v['aux']['sumFormula']}:\n#{v['value']} #{v['unit']}; (#{v['aux']['yield']} % yield)"
end,
}
Expand Down

0 comments on commit f6183d6

Please sign in to comment.