Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return the right number of artists, not one short, lol. #2839

Merged
merged 3 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion listenbrainz/db/lb_radio_artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def lb_radio_artist(mode: str, seed_artist: str, max_similar_artists: int, num_r
FROM randomize
JOIN mapping.mb_artist_metadata_cache
ON artist_mbid = similar_artist_mbid
WHERE rownum < {num_recordings_per_artist}
WHERE rownum <= {num_recordings_per_artist}
""").format(
seed_artist_mbid=Literal(uuid.UUID(seed_artist)),
similar_artist_limit=Literal(100),
Expand Down
22 changes: 15 additions & 7 deletions listenbrainz/tests/integration/test_settings_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,21 @@ def test_delete_listens(self):
self.assertEquals(task.user_id, self.user["id"])
self.assertEquals(task.task, "delete_listens")

# wait for background tasks to be processed
time.sleep(5)

# check that listens have been successfully deleted
resp = self.client.get(self.custom_url_for('api_v1.get_listen_count', user_name=self.user['musicbrainz_id']))
self.assert200(resp)
self.assertEqual(json.loads(resp.data)['payload']['count'], 0)
# wait for background tasks to be processed -- max 30s allowed for the test to pass
ok = False
for i in range(30):
time.sleep(1)

# check that listens have been successfully deleted
resp = self.client.get(self.custom_url_for('api_v1.get_listen_count', user_name=self.user['musicbrainz_id']))
self.assert200(resp)
if json.loads(resp.data)['payload']['count'] == 0:
continue
else:
ok = True

if not ok:
self.assertEqual(json.loads(resp.data)['payload']['count'], 0)

# check that the latest_import timestamp has been reset too
resp = self.client.get(self.custom_url_for('api_v1.latest_import', user_name=self.user['musicbrainz_id']))
Expand Down