Browse Source

Fixed issues with reports, queueSongs updating and queueSongs adding.

KrisVos130 8 years ago
parent
commit
f7ad1daa53

+ 2 - 2
backend/logic/actions/queueSongs.js

@@ -82,7 +82,7 @@ module.exports = {
 	update: hooks.adminRequired((session, songId, updatedSong, cb, userId) => {
 		async.waterfall([
 			(next) => {
-				db.models.queueSong.findOne({songId}, next);
+				db.models.queueSong.findOne({_id: songId}, next);
 			},
 
 			(song, next) => {
@@ -91,7 +91,7 @@ module.exports = {
 				let $set = {};
 				for (let prop in updatedSong) if (updatedSong[prop] !== song[prop]) $set[prop] = updatedSong[prop]; updated = true;
 				if (!updated) return next('No properties changed');
-				db.models.queueSong.update({songId}, {$set}, next);
+				db.models.queueSong.update({_id: songId}, {$set}, next);
 			}
 		], (err) => {
 			if (err) {

+ 2 - 2
backend/logic/actions/reports.js

@@ -97,10 +97,10 @@ module.exports = {
 		], (err, reports) => {
 			if (err) {
 				err = utils.getError(err);
-				logger.error("REPORTS_GETFORSONG", `Indexing reports for song "${songId}" failed. "${err}"`);
+				logger.error("GET_REPORTS_FOR_SONG", `Indexing reports for song "${songId}" failed. "${err}"`);
 				return cb({ 'status': 'failure', 'message': err});
 			} else {
-				logger.success("REPORTS_GETFORSONG", `Indexing report for song "{songId}" successful.`);
+				logger.success("GET_REPORTS_FOR_SONG", `Indexing reports for song "${songId}" successful.`);
 				return cb({ status: 'success', data: reports.length });
 			}
 		});

+ 1 - 1
backend/logic/actions/songs.js

@@ -177,7 +177,7 @@ module.exports = {
 	add: hooks.adminRequired((session, song, cb, userId) => {
 		async.waterfall([
 			(next) => {
-				queueSongs.remove(session, song.songId, () => {
+				queueSongs.remove(session, song._id, () => {
 					next();
 				});
 			},