-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Incorporate "Gas Scheme" feature in reaction variations table #2250
base: main
Are you sure you want to change the base?
Changes from all commits
3aef9d4
a4ba985
4390abe
45529d2
1bce0d9
90ae913
1d38a29
3aab97d
68a041e
6be3f02
246a0d0
77805bc
eb65ff2
73cd9a2
76037b8
86c6eec
3050dd8
eb9aba1
ad70f66
3634aa9
0c840a2
81d3974
f88e4eb
b80939b
807bd3d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,28 +20,28 @@ def properties | |
end | ||
end | ||
|
||
def materials(material_type) | ||
def materials(material_type, entity) | ||
{}.tap do |materials| | ||
object[material_type]&.each do |k, v| | ||
materials[k] = ReactionVariationMaterialEntity.represent(v) | ||
materials[k] = entity.represent(v) | ||
end | ||
end | ||
end | ||
|
||
def starting_materials | ||
materials(:startingMaterials) | ||
materials(:startingMaterials, StartingMaterialEntity) | ||
end | ||
|
||
def reactants | ||
materials(:reactants) | ||
materials(:reactants, StartingMaterialEntity) | ||
end | ||
|
||
def products | ||
materials(:products) | ||
materials(:products, ProductMaterialEntity) | ||
end | ||
|
||
def solvents | ||
materials(:solvents) | ||
materials(:solvents, SolventMaterialEntity) | ||
end | ||
end | ||
|
||
|
@@ -52,10 +52,33 @@ class ReactionVariationPropertyEntity < ApplicationEntity | |
) | ||
end | ||
|
||
class ReactionVariationMaterialEntity < ApplicationEntity | ||
class SolventMaterialEntity < ApplicationEntity | ||
expose :volume, using: 'Entities::ReactionVariationMaterialEntryEntity' | ||
|
||
expose :aux, using: 'Entities::ReactionVariationMaterialAuxEntity' | ||
end | ||
|
||
class ProductMaterialEntity < ApplicationEntity | ||
expose :mass, using: 'Entities::ReactionVariationMaterialEntryEntity' | ||
expose :amount, using: 'Entities::ReactionVariationMaterialEntryEntity' | ||
expose :volume, using: 'Entities::ReactionVariationMaterialEntryEntity' | ||
expose :yield, using: 'Entities::ReactionVariationMaterialEntryEntity' | ||
|
||
expose :duration, if: lambda { |object, _| object[:aux][:gasType] == 'gas' }, using: 'Entities::ReactionVariationMaterialEntryEntity' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Layout/LineLength: Line is too long. [137/120] |
||
expose :temperature, if: lambda { |object, _| object[:aux][:gasType] == 'gas' }, using: 'Entities::ReactionVariationMaterialEntryEntity' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style/Lambda: Use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Layout/LineLength: Line is too long. [140/120] |
||
expose :concentration, if: lambda { |object, _| object[:aux][:gasType] == 'gas' }, using: 'Entities::ReactionVariationMaterialEntryEntity' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style/Lambda: Use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Layout/LineLength: Line is too long. [142/120] |
||
expose :turnoverNumber, if: lambda { |object, _| object[:aux][:gasType] == 'gas' }, using: 'Entities::ReactionVariationMaterialEntryEntity' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style/Lambda: Use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Layout/LineLength: Line is too long. [143/120] |
||
expose :turnoverFrequency, if: lambda { |object, _| object[:aux][:gasType] == 'gas' }, using: 'Entities::ReactionVariationMaterialEntryEntity' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style/Lambda: Use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Layout/LineLength: Line is too long. [146/120] |
||
|
||
expose :aux, using: 'Entities::ReactionVariationMaterialAuxEntity' | ||
end | ||
|
||
class StartingMaterialEntity < ApplicationEntity | ||
expose :mass, using: 'Entities::ReactionVariationMaterialEntryEntity' | ||
expose :amount, using: 'Entities::ReactionVariationMaterialEntryEntity' | ||
expose :equivalent, using: 'Entities::ReactionVariationMaterialEntryEntity' | ||
|
||
expose :volume, if: lambda { |object, _| (object[:aux][:gasType] == 'feedstock') }, using: 'Entities::ReactionVariationMaterialEntryEntity' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style/Lambda: Use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Layout/LineLength: Line is too long. [143/120] |
||
|
||
expose :aux, using: 'Entities::ReactionVariationMaterialAuxEntity' | ||
end | ||
|
||
|
@@ -68,8 +91,9 @@ class ReactionVariationMaterialAuxEntity < ApplicationEntity | |
:molarity, | ||
:molecularWeight, | ||
:sumFormula, | ||
:yield, | ||
:equivalent, | ||
:gasType, | ||
:vesselVolume, | ||
:materialType, | ||
) | ||
end | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/Lambda: Use the
-> { ... }
lambda literal syntax for single line lambdas.