Browse Source

fixed queue bug

Akira Laine 9 years ago
parent
commit
b711f57900
2 changed files with 10 additions and 4 deletions
  1. 2 2
      app/client/scripts/events.js
  2. 8 2
      app/server/server.js

+ 2 - 2
app/client/scripts/events.js

@@ -634,11 +634,11 @@ Template.queues.events({
         newSong.duration = Number($("#duration").val());
         newSong.duration = Number($("#duration").val());
         newSong.skipDuration = $("#skip-duration").val();
         newSong.skipDuration = $("#skip-duration").val();
         newSong.requestedBy = Session.get("song").requestedBy;
         newSong.requestedBy = Session.get("song").requestedBy;
+        newSong.genres = Session.get("song").genres;
         if(newSong.skipDuration === undefined){
         if(newSong.skipDuration === undefined){
             newSong.skipDuration = 0;
             newSong.skipDuration = 0;
         }
         }
-        Meteor.call("updateQueueSong", Session.get("genre"), Session.get("song"), newSong, function(err, res) {
-            console.log(err, res);
+        Meteor.call("updateQueueSong", newSong.mid, newSong, function(err, res) {
             if (err) {
             if (err) {
                 var $toastContent = $('<span><strong>Song not saved.</strong> ' + err.reason + '</span>');
                 var $toastContent = $('<span><strong>Song not saved.</strong> ' + err.reason + '</span>');
                 Materialize.toast($toastContent, 8000);
                 Materialize.toast($toastContent, 8000);

+ 8 - 2
app/server/server.js

@@ -977,8 +977,14 @@ Meteor.methods({
     },
     },
     updateQueueSong: function (mid, newSong) {
     updateQueueSong: function (mid, newSong) {
         if (isModerator() && !isBanned()) {
         if (isModerator() && !isBanned()) {
-            newSong.mid = mid;
-            Queues.update({mid: mid}, newSong, function(err) {
+            Queues.update({mid: mid}, {$set: {
+                "title": newSong.title,
+                "artist": newSong.artist,
+                "id": newSong.id,
+                "img": newSong.img,
+                "duration" : newSong.duration,
+                "skipDuration" : newSong.skipDuration,
+            }}, function(err) {
                 console.log(err);
                 console.log(err);
                 if (err) {
                 if (err) {
                     throw err.sanitizedError;
                     throw err.sanitizedError;