Member Practice Summary Report and bugfixes

This commit is contained in:
Senad Uka
2019-08-08 04:56:46 +02:00
parent 55ddf76223
commit 23110d3c02
21 changed files with 13461 additions and 13 deletions

View File

@@ -2,6 +2,7 @@
const moment = require('moment-timezone');
const db = require('../../models/index');
const Op = require('sequelize').Op;
const { UI_TIMEZONE, BOOKING_CHANGE_PERCENTAGE_CHARGE, ALLOWED_BOOKING_CANCELLATION_TIME, incidentType } = require('../../constants/constants');
@@ -128,6 +129,20 @@ const chargeBookingChanges = (changes) => {
});
};
const getChargedCanceledReservations = (reservationIds) => {
const filters = {
reservationId: {
[Op.in]: reservationIds,
},
incidentType: incidentType.BOOKING_CANCELED_LATE,
};
const attributes = ['memberId', 'oldBookingStart', 'oldBookingEnd'];
return db.bookingChangeIncident.findAll({attributes, where: filters});
};
module.exports = {
chargeBookingChanges,
getChargedCanceledReservations,
};