...
relevance and condition are Nice to have.
Methods
getRuleDetails(classname)
NEED TO BE DEFINED ON ABSTRACT CLASS LEVEL
...
if object.class == classname
return object
getParamteres(ClassName, instance)
NEED TO BE DEFINED ON ABSTRACT CLASS LEVEL
#className is the class name of the object where the calculation param need to be added
#instance is where the link with a calculation need to be found, like the CPB in case of PH insuree or Contract Details
This function has two steps
1- getRuleDetails(className)
2- define if the calculation should be used
for each “eligible“ ruleDetails,
checkCalculation(instance) #check if the calculation is really concerning the class for that context
return a list only with rule details that matches step 1 and 2
runCalculationRules(instance, context)
NEED TO BE DEFINED ON ABSTRACT CLASS LEVEL
this function will be register to the module signal via the ready function if the rule is active
1- getRuleDetails(instance.__class__)
2 if activeForObject(instance)
calculate(instance)
ready()
NEED TO BE DEFINED ON RULE LEVEL
...
This function is required because the same class can have different calculation based on the object members values (like product ….)
...
(
...
NEED TO BE DEFINED ON RULE LEVEL
this function will be register to the module signal via the ready function if the rule is active
1- getRuleDetails(instance.__class__)
2 if activeForObject(instance)
calculate(instance)
(TDC)calculateEvent(sender, instance, user, **kwargs)
...
that function will return the possible instance that can have a link to the calculation
getParamteres(ClassName, instance)
NEED TO BE DEFINED ON RULE LEVEL
#className is the class name of the object where the calculation param need to be added
#instance is where the link with a calculation need to be found, like the CPB in case of PH insuree or Contract Details
This function has two steps
1- getRuleDetails(className)
2- define if the calculation should be used
for each “eligible“ ruleDetails,
...
calculation
...
Module function/Service
NEED TO BE DEFINED ON MODULE LEVEL
getRuleDetails(classname)
this function will send a signal and the rules will reply if they have object matching the classname in their list of object
...