Merge branch 'remove-first-5-minutes-from-unscheduled-use' into 'master'
remove first N minutes from unscheduled use (N is time resolution) See merge request saburly/psihologija!78
This commit was merged in pull request #78.
This commit is contained in:
@@ -255,9 +255,8 @@ const analyseReservation = (reservation) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let timeIntervalsToChargeBefore = Math.floor(timeDifferenceFromUnlockEntry / UNSCHEDULED_TIME_RESOLUTION);
|
let timeIntervalsToChargeBefore = Math.floor(timeDifferenceFromUnlockEntry / UNSCHEDULED_TIME_RESOLUTION);
|
||||||
if (timeDifferenceFromUnlockEntry < UNSCHEDULED_USE_INITIAL_TIME_SEGMENT_LENGTH){
|
timeIntervalsToChargeBefore -= 1; // Remove first N minutes, N = UNSCHEDULED_TIME_RESOLUTION
|
||||||
timeIntervalsToChargeBefore = 0;
|
|
||||||
}
|
|
||||||
const totalChargeFeeBefore = timeIntervalsToChargeBefore * UNSCHEDULED_CHARGE_PRICE;
|
const totalChargeFeeBefore = timeIntervalsToChargeBefore * UNSCHEDULED_CHARGE_PRICE;
|
||||||
const chargeBefore = totalChargeFeeBefore > 0;
|
const chargeBefore = totalChargeFeeBefore > 0;
|
||||||
|
|
||||||
@@ -267,9 +266,8 @@ const analyseReservation = (reservation) => {
|
|||||||
timeDifferenceFromLockEntry = lockTime.diff(currentReservationEnd, 'minutes');
|
timeDifferenceFromLockEntry = lockTime.diff(currentReservationEnd, 'minutes');
|
||||||
}
|
}
|
||||||
let timeIntervalsToChargeAfter = Math.floor(timeDifferenceFromLockEntry / UNSCHEDULED_TIME_RESOLUTION);
|
let timeIntervalsToChargeAfter = Math.floor(timeDifferenceFromLockEntry / UNSCHEDULED_TIME_RESOLUTION);
|
||||||
if (timeDifferenceFromLockEntry < UNSCHEDULED_USE_INITIAL_TIME_SEGMENT_LENGTH){
|
timeIntervalsToChargeAfter -= 1; // Remove first N minutes, N = UNSCHEDULED_TIME_RESOLUTION
|
||||||
timeIntervalsToChargeAfter = 0;
|
|
||||||
}
|
|
||||||
const totalChargeFeeAfter = timeIntervalsToChargeAfter * UNSCHEDULED_CHARGE_PRICE;
|
const totalChargeFeeAfter = timeIntervalsToChargeAfter * UNSCHEDULED_CHARGE_PRICE;
|
||||||
const chargeAfter = totalChargeFeeAfter > 0;
|
const chargeAfter = totalChargeFeeAfter > 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user