Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

2 if activeForObject(instance)

calculate(instance)
ready()

NEED TO BE DEFINED ON RULE LEVEL

This method makes sure the calculation is registered in the calculation table (if not the line should be added with "inactive status") and register the signals only if it is active

all rules, if active will have to register to the signal sent by “getRuleDetails”

activeForObject(object, context)

NEED TO BE DEFINED ON RULE LEVEL

this method will contains the checks if the calculation need to be executed for the object on that context. the default context will be:

  • create

  • update

  • delete

  • submit

  • amend

  • replace

  • check

  • validate

This function is required because the same class can have different calculation based on the object members values (like product ….)

(TDC)calculateEvent(sender, instance, user, **kwargs)

NEED TO BE DEFINED ON RULE LEVEL

  • This method runs the calculation based on the object sending the signal, this means that the relationship with the other item required for the calculation could be found from the object sending the signal. (e.g., link to the product can be found in the policy as foreign key.)

  • This function should call first the activeForObject method, the context will depend on the calling event, if the fuction return true the calcuation needs to be run, in other case the even handling will stop

  • the calculate(*args) function

  • Signal need to be set up on the ready function to call it

checkCalculation(instance)

NEED TO BE DEFINED ON RULE LEVEL

this function will get the calculation relative the instance

1- get instance class

2- if class known then return check that the linked calculation is the current one

calculate(instance, *args)

NEED TO BE DEFINED ON RULE LEVEL

Function that will do the calculation based on the parameters

getLinkedClass(List[classname])

NEED TO BE DEFINED ON RULE LEVEL

that function will return the possible instance that can have a link to the calculation

Module function/Service

NEED TO BE DEFINED ON MODULE LEVEL

...