Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fee scheme settings using configuration driven approach #2440

Open
lostie opened this issue Jul 23, 2018 · 0 comments
Open

Fee scheme settings using configuration driven approach #2440

lostie opened this issue Jul 23, 2018 · 0 comments

Comments

@lostie
Copy link
Contributor

lostie commented Jul 23, 2018

The idea behind this is to move towards an approach that avoids having code like this:

def call
  ...
  return agfs_reform_categories if agfs_reform? || Offence.in_scheme_ten.include?(claim.offence)
  default_categories
end

def default_categories
  Settings.advocate_categories
end

def agfs_reform_categories
  Settings.agfs_reform_advocate_categories
end

def agfs_reform?
  claim.fee_scheme&.agfs? && claim.fee_scheme.version >= 10
end

in favour of:

# settings.yml
fee_schemes:
  agfs_9:
    advocate_categories: ['foo']
  agfs_10:
    advocate_categories: ['bar']
  agfs_11:
    advocate_categories: ['zzz']

# meta code just to illustrate the idea of what we're trying to do
def call
  ..
  claim.advocate_categories
  # which actually does 
  Settings['fee_schemes'][claim.fee_scheme]['advocate_categories']
end  

Where we always ask the claim which fee scheme its on and then the fee scheme has the associated information for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant