Skip to content

Commit

Permalink
馃悰 Correctly add up likes and dislikes
Browse files Browse the repository at this point in the history
  • Loading branch information
niksudan committed Aug 14, 2020
1 parent 833deb8 commit 9bf7a59
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/lib/bot.ts
Expand Up @@ -19,7 +19,7 @@ import SoundCloud from './soundcloud';
require('dotenv').config();

const LIKE_THRESHOLD = 2;
const DISLIKE_THRESHOLD = 2;
const DISLIKE_THRESHOLD = -2;
const ARTISTS_THRESHOLD = 2;
const NUMBER_OF_ITEMS = 5;

Expand All @@ -32,7 +32,6 @@ interface TrackData {
service: Service;
author: User;
likes: number;
dislikes: number;
}

interface Service {
Expand Down Expand Up @@ -166,14 +165,13 @@ export default class Bot {
}

// Ignore pretty disliked tracks
if (dislikes < DISLIKE_THRESHOLD) {
if (likes - dislikes <= DISLIKE_THRESHOLD) {
trackData = trackData.concat(
match.map((url) => ({
url,
service,
author,
likes,
dislikes,
likes: likes - dislikes,
})),
);
}
Expand Down

0 comments on commit 9bf7a59

Please sign in to comment.