WIP: Targets configurable with Quantities
This commit is contained in:
14
test/fixtures/formulas.yml
vendored
14
test/fixtures/formulas.yml
vendored
@@ -0,0 +1,14 @@
|
||||
formulas_01:
|
||||
quantity: quantities_target_above
|
||||
zero_nil: false
|
||||
code: value >= above
|
||||
|
||||
formulas_02:
|
||||
quantity: quantities_target_range
|
||||
zero_nil: false
|
||||
code: (value >= above) && (value <= 'and below')
|
||||
|
||||
formulas_03:
|
||||
quantity: quantities_target_equal
|
||||
zero_nil: false
|
||||
code: value == equal
|
||||
|
||||
40
test/fixtures/quantities.yml
vendored
40
test/fixtures/quantities.yml
vendored
@@ -1,17 +1,49 @@
|
||||
quantities_energy:
|
||||
DEFAULTS: &DEFAULTS
|
||||
project_id: 1
|
||||
domain: diet
|
||||
parent: null
|
||||
|
||||
quantities_energy:
|
||||
<<: *DEFAULTS
|
||||
domain: diet
|
||||
lft: 1
|
||||
rgt: 2
|
||||
depth: 0
|
||||
name: Energy
|
||||
description: Total energy
|
||||
|
||||
quantities_proteins:
|
||||
project_id: 1
|
||||
<<: *DEFAULTS
|
||||
domain: diet
|
||||
parent: null
|
||||
lft: 3
|
||||
rgt: 4
|
||||
depth: 0
|
||||
name: Proteins
|
||||
description: Total amount of proteins
|
||||
|
||||
quantities_target_above:
|
||||
<<: *DEFAULTS
|
||||
domain: target
|
||||
lft: 5
|
||||
rgt: 8
|
||||
depth: 0
|
||||
name: above
|
||||
description: Lower bound
|
||||
|
||||
quantities_target_range:
|
||||
<<: *DEFAULTS
|
||||
parent: quantities_target_above
|
||||
domain: target
|
||||
lft: 6
|
||||
rgt: 7
|
||||
depth: 1
|
||||
name: and below
|
||||
description: Range
|
||||
|
||||
quantities_target_equal:
|
||||
<<: *DEFAULTS
|
||||
domain: target
|
||||
lft: 9
|
||||
rgt: 10
|
||||
depth: 0
|
||||
name: equal
|
||||
description: Exact value
|
||||
|
||||
2
test/fixtures/quantity_values.yml
vendored
2
test/fixtures/quantity_values.yml
vendored
@@ -2,6 +2,6 @@ quantity_values_001:
|
||||
type: Threshold
|
||||
registry_type: Target
|
||||
registry: targets_01
|
||||
quantity: quantities_energy
|
||||
quantity: quantities_target_equal
|
||||
value: 2500
|
||||
unit: units_kcal
|
||||
|
||||
2
test/fixtures/targets.yml
vendored
2
test/fixtures/targets.yml
vendored
@@ -1,4 +1,4 @@
|
||||
targets_01:
|
||||
goal: goals_binding
|
||||
condition: '=='
|
||||
quantity: quantities_energy
|
||||
effective_from: <%= 1.week.ago.to_s(:db) %>
|
||||
|
||||
Reference in New Issue
Block a user