Browse Source

Fixed issue where new songs can't be liked, because it sets it to a string instead of a number.

KrisVos130 9 years ago
parent
commit
dd43924ef1
2 changed files with 7 additions and 5 deletions
  1. 3 3
      app/client/client.js
  2. 4 2
      app/server/server.js

+ 3 - 3
app/client/client.js

@@ -998,13 +998,13 @@ Template.stations.events({
     "click #save-song-button": function() {
         var newSong = {};
         newSong.id = $("#id").val();
-        newSong.likes = $("#likes").val();
-        newSong.dislikes = $("#dislikes").val();
+        newSong.likes = Number($("#likes").val());
+        newSong.dislikes = Number($("#dislikes").val());
         newSong.title = $("#title").val();
         newSong.artist = $("#artist").val();
         newSong.img = $("#img").val();
         newSong.type = $("#type").val();
-        newSong.duration = $("#duration").val();
+        newSong.duration = Number($("#duration").val());
         newSong.skipDuration = $("#skip-duration").val();
         if(newSong.skipDuration === undefined){
             newSong.skipDuration = 0;

+ 4 - 2
app/server/server.js

@@ -651,6 +651,8 @@ Meteor.methods({
                                     artist: songData.artist,
                                     duration: songData.duration,
                                     skipDuration: songData.skipDuration,
+                                    likes: songData.likes,
+                                    dislikes: songData.dislikes,
                                     img: songData.img,
                                     type: songData.type
                                 }
@@ -729,8 +731,8 @@ Meteor.methods({
                                 skipDuration: songData.skipDuration,
                                 img: songData.img,
                                 type: songData.type,
-                                likes: songData.likes,
-                                dislikes: songData.dislikes
+                                likes: Number(songData.likes),
+                                dislikes: Number(songData.dislikes)
                             }
                         }
                     });