Skip to content

Commit

Permalink
Merge pull request #53 from openimis/release/23.10
Browse files Browse the repository at this point in the history
MERGING release/23.10 into main
  • Loading branch information
hirensoni913 authored Jan 16, 2024
2 parents 80375d3 + 1553464 commit 546cb34
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
12 changes: 5 additions & 7 deletions calculation/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,13 @@ class CalculationConfig(AppConfig):
gql_query_calculation_rule_perms = []
gql_mutation_update_calculation_rule_perms = []

def _configure_permissions(self, cfg):
CalculationConfig.gql_query_calculation_rule_perms = cfg[
"gql_query_calculation_rule_perms"]
CalculationConfig.gql_mutation_update_calculation_rule_perms = cfg[
"gql_mutation_update_calculation_rule_perms"
]
def __load_config(self, cfg):
for field in cfg:
if hasattr(CalculationConfig, field):
setattr(CalculationConfig, field, cfg[field])

def ready(self):
from core.models import ModuleConfiguration
cfg = ModuleConfiguration.get_or_default(MODULE_NAME, DEFAULT_CFG)
self._configure_permissions(cfg)
self.__load_config(cfg)
read_all_calculation_rules()
2 changes: 1 addition & 1 deletion calculation/calculation_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def calculate(cls, instance, **kwargs):
def get_linked_class(cls, sender, class_name, **kwargs):
list_class = []
if class_name is not None:
model_class = ContentType.objects.filter(model=class_name).first()
model_class = ContentType.objects.filter(model__iexact=class_name).first()
if model_class:
model_class = model_class.model_class()
list_class = list_class + \
Expand Down
1 change: 1 addition & 0 deletions calculation/migrations/0004_auto_20230126_0903.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class Migration(migrations.Migration):

dependencies = [
('calculation', '0003_add_calculation_roles_for_admin'),
('contribution_plan', '0009_contributionplan_roles_for_admin'),
]

operations = [
Expand Down
2 changes: 1 addition & 1 deletion calculation/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def resolve_calculation_params(parent, info, **kwargs):
instance = calculation_rule
else:
# get the instance class name to get instance object by uuid
instance_type = ContentType.objects.get(model=f'{instance_class_name}')
instance_type = ContentType.objects.get(model__iexact=f'{instance_class_name}')
instance_class = instance_type.model_class()
instance = instance_class.objects.get(id=instance_id)

Expand Down

0 comments on commit 546cb34

Please sign in to comment.