scheduled session - RSVP slot updated

This commit is contained in:
Bert Owen 2014-06-14 21:25:32 +08:00
parent 88a7ba197a
commit d4b467fd42
2 changed files with 22 additions and 6 deletions

View File

@ -255,6 +255,8 @@ module JamRuby
unless ms.errors.any?
ms.reload
rsvp_slot_ids = []
self_rsvp_slot_ids = []
options[:rsvp_slots].each do |rs|
rsvp = RsvpSlot.new
rsvp.instrument = Instrument.find(rs[:instrument_id])
@ -263,7 +265,21 @@ module JamRuby
rsvp.save
ms.rsvp_slots << rsvp
if rs[:approved]
self_rsvp_slot_ids.push rsvp.id
else
rsvp_slot_ids.push rsvp.id
end
end if options[:rsvp_slots]
RsvpRequest.create({session_id: ms.id, rsvp_slots: rsvp_slot_ids}, user)
rsvp_rq_ids = RsvpRequest.create({session_id: ms.id, rsvp_slots: self_rsvp_slot_ids}).map(&:id)
self_rsvp_rq = []
rsvp_rq_ids.each do |rsvp_rq|
self_rsvp_rq.push {request_slot_id: rsvp_rq, approved: true}
end
RsvpRequest.update({session_id: ms.id, rsvp_responses: self_rsvp_rq})
options[:invitations].each do |invite_id|
invitation = Invitation.new

View File

@ -419,14 +419,14 @@
data.rsvp_slots = [];
$.each(instrumentSelector.getSelectedInstruments(), function(index, instrument) {
data.rsvp_slots.push({instrument: instrument.id, proficiency_level: instrument.level});
data.rsvp_slots.push({instrument: instrument.id, proficiency_level: instrument.level. approve: false});
});
// var instruments_rsvp = [];
// $.each(instrumentRSVP.getSelectedInstruments(), function(index, instrument) {
// instruments_rsvp.push(instrument.name + ' (' + instrument.count + ') (' + instrument.level + ')');
// });
// $('#session-instruments-rsvp-disp').html(instruments_rsvp.join(', '));
$.each(instrumentRSVP.getSelectedInstruments(), function(index, instrument) {
for (var i = 0; i < instrument.count; i++) {
data.rsvp_slots.push({instrument: instrument.id, proficiency_level: instruemnt.level, approve: true});
}
});
}
var tracks = context.JK.TrackHelpers.getUserTracks(context.jamClient);