From b717ce7a1495dbc6bce856e419ed9aec82544047 Mon Sep 17 00:00:00 2001 From: bohung Date: Thu, 15 Oct 2020 15:49:25 +0800 Subject: [PATCH] Fix bug. --- app/models/venue_management_bill.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/models/venue_management_bill.rb b/app/models/venue_management_bill.rb index 565410e..6f0e283 100644 --- a/app/models/venue_management_bill.rb +++ b/app/models/venue_management_bill.rb @@ -73,10 +73,18 @@ class VenueManagementBill i = find_insert_index(days,delay_in_days) ref = JSON.parse(\"{\\\"annual_interest\\\": #{1/365.0},\\\"double_dividend\\\": #{1/2.0},\\\"daily_interest\\\": #{1/1.0}}\") if(days[i-1] < delay_in_days && interest_types[i-1] != undefined ){ - result = _interests[i - 1] * (delay_in_days * ref[interest_types[i-1]]).ceil() + if(interest_types[i-1] == 'double_dividend'){ + result = _interests[i - 1] * (delay_in_days * ref[interest_types[i-1]]).ceil() + }else{ + result = _interests[i - 1] * (delay_in_days * ref[interest_types[i-1]]) + } }else{ if(i != 1 && days[i-2] < delay_in_days && interest_types[i-2] != undefined ){ - result = _interests[i - 2] * (delay_in_days * ref[interest_types[i-2]]).ceil() + if(interest_types[i-2] == 'double_dividend'){ + result = _interests[i - 2] * (delay_in_days * ref[interest_types[i-2]]).ceil() + }else{ + result = _interests[i - 2] * (delay_in_days * ref[interest_types[i-2]]) + } }else{ result = 0 }