I hope you can help me.
I have a Rated that has reviews , I have several calculations to determine whether or not it will go through a trial step.
For example one of these calculations is calcula_pontuacao_minima()
#Cálculo definido pela resolução 1
def calcula_pontuacao_minima(avaliado)
calcula_porcentagem(avaliado.avaliacoes)>60 #onde esta soma todas as notas do avaliado e retorna a porcentagem de aproveitamento
end
My problem here is the appearance of resolutions that change the calculation , so all evaluated before this resolution must be evaluated by the old calculations and the new ones must be sorted using the calculations changed. For example a resolution changes the minimum value to 50%
#Cálculo definido pela resolução 2
def calcula_pontuacao_minima(avaliado)
calcula_porcentagem(avaliado.avaliacoes)>50 #onde esta soma todas as notas do avaliado e retorna a porcentagem de aproveitamento
end
And if in the future they still change to instead of taking the percentage, the minimum value is compared to the total value of the evaluations
#Cálculo definido pela resolução 3
def calcula_pontuacao_minima(avaliado)
calcula_total(avaliado.avaliacoes)>70 #onde esta soma todas as notas do avaliado onde o máximo é 120
end
For example Evaluated that had their evaluations done before the X date that defined resolution 2 , they will be evaluated by the first calculation, after that date X will be evaluated by the second calculation , and after the date Y , will be evaluated by the third calculation .
Any ideas how this can be solved? Would it be good to store database-level calculations?