directus-extension-hook-formula
v1.0.1
Published
When new record is inserted into **system_projection** collection. It will trigger this hook to compute values based on custom formula and insert record into **benchmark_manhour** and **manhour_distribution** collections.
Downloads
12
Maintainers
Readme
Introduction
When new record is inserted into system_projection collection. It will trigger this hook to compute values based on custom formula and insert record into benchmark_manhour and manhour_distribution collections.
Procedure
Input (Trigger)
- collection => system_projection AND field => revenue
Variables
- (FOR benchmark_manhour) collection => formulas AND field => formula_expression, type = 'benchmark-manhour'
- (FOR manhour_distribution) collection => benchmark_ratio AND field => kitchen_ratio, bar_ratio, foh_ratio, cleaning_ratio
Result
- collection => benchmark_manhour AND fields => shop_cd,date,manhours
e.g. manhours = 0.0006Math.pow(<revenue>,2)+266.79<revenue>-20323
- collection => manhour_distribution AND fields => shop_cd, date, kitchen_manhours, bar_manhours,cleaning_manhours,foh_manhours
e.g. kitchen_manhours = kitchen_ratio * <revenue>
Formula Format
0.0006Math.pow(<revenue>,2)+266.79<revenue>-20323 where <revenue> field in system_projection collection
Requirement for manhour_distribution computation
collection benchmark_ratio must have ratios for shop_cd