Jelajahi Sumber

Fixed issues with updating genres and playlist calculating genre being case sensitive

Kristian Vos 4 tahun lalu
induk
melakukan
938ff0c295

+ 5 - 2
backend/logic/stations.js

@@ -330,15 +330,18 @@ class _StationsModule extends CoreClass {
 						if (payload.station.genres.length === 0) return next();
 
 						const genresDone = [];
+						const blacklistedGenres = payload.station.blacklistedGenres.map(blacklistedGenre =>
+							blacklistedGenre.toLowerCase()
+						);
 
 						return payload.station.genres.forEach(genre => {
-							songModel.find({ genres: genre }, (err, songs) => {
+							songModel.find({ genres: { $regex: genre, $options: "i" } }, (err, songs) => {
 								if (!err) {
 									songs.forEach(song => {
 										if (songList.indexOf(song._id) === -1) {
 											let found = false;
 											song.genres.forEach(songGenre => {
-												if (payload.station.blacklistedGenres.indexOf(songGenre) !== -1)
+												if (blacklistedGenres.indexOf(songGenre.toLowerCase()) !== -1)
 													found = true;
 											});
 											if (!found) {

+ 1 - 1
frontend/src/components/modals/EditStation.vue

@@ -487,7 +487,7 @@ export default {
 		};
 	},
 	computed: {
-		...mapState("admin/station", {
+		...mapState("admin/stations", {
 			stations: state => state.stations
 		}),
 		...mapState({