directus-extension-hook-formula

1.0.1 • Public • Published

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)

  1. collection => system_projection AND field => revenue

Variables

  1. (FOR benchmark_manhour) collection => formulas AND field => formula_expression, type = 'benchmark-manhour'
  2. (FOR manhour_distribution) collection => benchmark_ratio AND field => kitchen_ratio, bar_ratio, foh_ratio, cleaning_ratio

Result

  1. collection => benchmark_manhour AND fields => shop_cd,date,manhours

e.g. manhours = 0.0006Math.pow(<revenue>,2)+266.79<revenue>-20323

  1. 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

Package Sidebar

Install

npm i directus-extension-hook-formula

Weekly Downloads

1

Version

1.0.1

License

none

Unpacked Size

4.8 kB

Total Files

4

Last publish

Collaborators

  • mshoaibraja