VRFS-2489 scheduled session with is_unstructured_rsvp=true should not prompt user to add slots when approving
This commit is contained in:
parent
e87ab392e6
commit
a46664acfe
|
|
@ -87,48 +87,54 @@
|
|||
var instrumentIds = $(e.target).attr('data-instrument-text');
|
||||
var params = buildRsvpRequestActionParams(rsvpId, true);
|
||||
|
||||
// first check if any open slots exist for these instruments
|
||||
rest.getOpenSessionSlots(sessionData.id, true)
|
||||
.done(function(openSlots) {
|
||||
if (openSlots) {
|
||||
if (openSlots.length === 0) {
|
||||
ui.launchRsvpCreateSlotDialog(sessionData.id, instrumentIds.split('|'), userName, function() {
|
||||
approve(rsvpId, params);
|
||||
});
|
||||
}
|
||||
else {
|
||||
var arrInstrumentIds = instrumentIds.split('|');
|
||||
var openSlotInstrumentIds = [];
|
||||
var unavailableSlotInstrumentIds = [];
|
||||
if (sessionData['is_unstructured_rsvp?']) {
|
||||
approve(rsvpId, params);
|
||||
}
|
||||
|
||||
// ensure each instrument in the user's list is available in the open slots list
|
||||
$.each(openSlots, function(index, slot) {
|
||||
openSlotInstrumentIds.push(slot.instrument_id);
|
||||
});
|
||||
|
||||
// build list of instrument IDs in the RSVP request for which there are no open slots
|
||||
for (var i=0; i < arrInstrumentIds.length; i++) {
|
||||
if ($.inArray(arrInstrumentIds[i], openSlotInstrumentIds) === -1) {
|
||||
unavailableSlotInstrumentIds.push(arrInstrumentIds[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (unavailableSlotInstrumentIds.length > 0) {
|
||||
ui.launchRsvpCreateSlotDialog(sessionData.id, unavailableSlotInstrumentIds, userName, function() {
|
||||
approve(rsvpId, params);
|
||||
});
|
||||
// check if any open slots exist for these instruments
|
||||
else {
|
||||
rest.getOpenSessionSlots(sessionData.id, true)
|
||||
.done(function(openSlots) {
|
||||
if (openSlots) {
|
||||
if (openSlots.length === 0) {
|
||||
ui.launchRsvpCreateSlotDialog(sessionData.id, instrumentIds.split('|'), userName, function() {
|
||||
approve(rsvpId, params);
|
||||
});
|
||||
}
|
||||
else {
|
||||
approve(rsvpId, params);
|
||||
var arrInstrumentIds = instrumentIds.split('|');
|
||||
var openSlotInstrumentIds = [];
|
||||
var unavailableSlotInstrumentIds = [];
|
||||
|
||||
// ensure each instrument in the user's list is available in the open slots list
|
||||
$.each(openSlots, function(index, slot) {
|
||||
openSlotInstrumentIds.push(slot.instrument_id);
|
||||
});
|
||||
|
||||
// build list of instrument IDs in the RSVP request for which there are no open slots
|
||||
for (var i=0; i < arrInstrumentIds.length; i++) {
|
||||
if ($.inArray(arrInstrumentIds[i], openSlotInstrumentIds) === -1) {
|
||||
unavailableSlotInstrumentIds.push(arrInstrumentIds[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (unavailableSlotInstrumentIds.length > 0) {
|
||||
ui.launchRsvpCreateSlotDialog(sessionData.id, unavailableSlotInstrumentIds, userName, function() {
|
||||
approve(rsvpId, params);
|
||||
});
|
||||
}
|
||||
else {
|
||||
approve(rsvpId, params);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
ui.launchRsvpCreateSlotDialog(sessionData.id, instrumentIds.split('|'), userName, function() {
|
||||
approve(rsvpId, params);
|
||||
});
|
||||
}
|
||||
});
|
||||
else {
|
||||
ui.launchRsvpCreateSlotDialog(sessionData.id, instrumentIds.split('|'), userName, function() {
|
||||
approve(rsvpId, params);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function approve(rsvpId, params) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue