Skip to content

Commit

Permalink
Show artist-recording and artist-release_group rels even if marked ended
Browse files Browse the repository at this point in the history
Relationships like performer relations are ended by definition because an artist performed
something on a particular date. Other recording and release group rels also make sense to
be shown to users always. However, ended url rels are only for historical purposes and do
not need to be shown to users.
  • Loading branch information
amCap1712 committed Jan 29, 2024
1 parent 4c40e24 commit bfeeb4f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions listenbrainz_spark/stats/listener/release_group.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from typing import Iterator, List

from data.model.entity_listener_stat import ArtistListenerRecord
from data.model.entity_listener_stat import ReleaseGroupListenerRecord
from listenbrainz_spark.stats import run_query


def get_listeners(table: str, cache_tables: List[str], number_of_results: int) -> Iterator[ArtistListenerRecord]:
def get_listeners(table: str, cache_tables: List[str], number_of_results: int) -> Iterator[ReleaseGroupListenerRecord]:
""" Get information about top listeners of a release group.
Args:
Expand Down
3 changes: 2 additions & 1 deletion mbid_mapping/mapping/mb_metadata_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ def get_metadata_cache_query(self, with_values=False):
ON l.link_type = lt.id
{values_join}
WHERE lt.gid IN ({ARTIST_LINK_GIDS_SQL})
-- do not show outdated urls to users
AND NOT l.ended
GROUP BY a.gid
), recording_rels AS (
Expand All @@ -211,7 +212,7 @@ def get_metadata_cache_query(self, with_values=False):
ON la.attribute_type = lat.id
{values_join}
WHERE lt.gid IN ({RECORDING_LINK_GIDS_SQL})
AND NOT l.ended
-- performer rels are ended by definition (the artist is no longer performing) but they should still be shown to the user
GROUP BY r.gid
), artist_data AS (
SELECT r.gid
Expand Down
3 changes: 2 additions & 1 deletion mbid_mapping/mapping/mb_release_group_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ def get_metadata_cache_query(self, with_values=False):
ON l.link_type = lt.id
{values_join}
WHERE lt.gid IN ({ARTIST_LINK_GIDS_SQL})
-- do not show outdated urls to users
AND NOT l.ended
GROUP BY a.gid
), release_group_rels AS (
Expand All @@ -232,7 +233,7 @@ def get_metadata_cache_query(self, with_values=False):
ON la.attribute_type = lat.id
{values_join}
WHERE lt.gid IN ({RELEASE_GROUP_LINK_GIDS_SQL})
AND NOT l.ended
-- the release group rels we use make sense to be shown to the user even if they have been marked as ended
GROUP BY rg.gid
), artist_data AS (
SELECT rg.gid
Expand Down

0 comments on commit bfeeb4f

Please sign in to comment.