1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-29 18:52:22 +01:00

fix computing reservation price

This commit is contained in:
Sylvain 2021-07-02 15:45:52 +02:00
parent 95d8f1d204
commit 920a97f40f
2 changed files with 3 additions and 1 deletions

View File

@ -86,7 +86,7 @@ class CartItem::Reservation < CartItem::BaseItem
slot_rate
end
# subtract free minutes from prepaid packs
if real_price.positive? && options[:prepaid][:minutes] >= 0
if real_price.positive? && options[:prepaid][:minutes]&.positive?
consumed = slot_minutes
consumed = options[:prepaid][:minutes] if slot_minutes > options[:prepaid][:minutes]
real_price = (slot_minutes - consumed) * (slot_rate / MINUTES_PER_HOUR)

View File

@ -1,5 +1,7 @@
# frozen_string_literal: true
require 'test_helper'
module Prices
class AsAdminTest < ActionDispatch::IntegrationTest
setup do