1
0

WIP: Targets configurable with Quantities

This commit is contained in:
cryptogopher
2021-02-07 11:02:41 +01:00
parent 316005bf1f
commit 8b17b33603
23 changed files with 218 additions and 108 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -1,4 +1,4 @@
targets_01:
goal: goals_binding
condition: '=='
quantity: quantities_energy
effective_from: <%= 1.week.ago.to_s(:db) %>