Created
January 17, 2018 21:02
-
-
Save valterbarros/23f3752182352968111926fba42eac06 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calculate_scheduled_for_the_month | |
sum = 0.0 | |
return sum if @planning.empty? | |
where_for_planning = clause_where_for_planning | |
i = 0 | |
@planning.where(where_for_planning).each do |p| | |
p.preenchimentos.each_with_index do |obj, index| | |
obj.dth_inicio = Time.now - index.days | |
obj.dth_fim = Time.now + index.days | |
obj.save | |
i += 1 | |
break if i == 2 | |
end | |
value_to_decrease = percentage_qtd_executed_not_formmatted(p, clause_where_for_fvs) | |
sum += value_to_decrease | |
end | |
final_percentage_formatted sum | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment