Simply updating data in the Slides collection instead of removing and adding whole objects
This commit is contained in:
parent
8d18271579
commit
f287f5f4cb
@ -13,11 +13,15 @@ this.displayThisSlide = function(meetingId, newSlideId, slideObject) {
|
||||
"slide.current": false
|
||||
}
|
||||
});
|
||||
// for the new slide: remove the version which came with presentation_shared_message from the Collection
|
||||
// to avoid using old data (this message contains everything we need for the new slide)
|
||||
removeSlideFromCollection(meetingId, newSlideId);
|
||||
// add the new slide to the collection
|
||||
return addSlideToCollection(meetingId, presentationId, slideObject);
|
||||
|
||||
Meteor.Slides.update({
|
||||
presentationId: presentationId,
|
||||
"slide.id": newSlideId
|
||||
}, {
|
||||
$set: {
|
||||
"slide.current": true
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.addSlideToCollection = function(meetingId, presentationId, slideObject) {
|
||||
@ -48,23 +52,6 @@ this.addSlideToCollection = function(meetingId, presentationId, slideObject) {
|
||||
}
|
||||
};
|
||||
|
||||
this.removeSlideFromCollection = function(meetingId, slideId) {
|
||||
let id;
|
||||
if((meetingId != null) && (slideId != null) && (Meteor.Slides.findOne({
|
||||
meetingId: meetingId,
|
||||
"slide.id": slideId
|
||||
}) != null)) {
|
||||
id = Meteor.Slides.findOne({
|
||||
meetingId: meetingId,
|
||||
"slide.id": slideId
|
||||
});
|
||||
if(id != null) {
|
||||
Meteor.Slides.remove(id._id);
|
||||
return Meteor.log.info(`----removed slide[${slideId}] from ${meetingId}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// called on server start and meeting end
|
||||
this.clearSlidesCollection = function(meetingId) {
|
||||
if(meetingId != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user