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
CB-84: Add checkbox to filter releases with reviews on artist discography pages. #153
Conversation
<div class="col-sm-4"> | ||
<div> | ||
<input type="checkbox" name="only-reviewed" value="1" class="only-reviewed" onchange="showOnlyReviewed()"/> | ||
{{ _('Filter releases here with reviews') }}<br/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Only show releases with reviews"
@@ -66,13 +76,16 @@ | |||
<a href="{{ url_for('artist.entity', mbid=artist.id) }}?release_type=other">{{ _('Other releases') }}</a> | |||
</li> | |||
</ul> | |||
<div class="no_reviewed_entities"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the default is to not check the box, can you make this hidden by default instead of hiding it in js?
</div> | ||
<div class="col-sm-4"> | ||
<div> | ||
<input type="checkbox" name="only-reviewed" value="1" class="only-reviewed" onchange="showOnlyReviewed()"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of using an html attribute here, other places in the CB code us jquery to install an event handler:
$("#btn-publish").click(function(){ |
We should do the same thing for consistency
{% block scripts %} | ||
{{ super() }} | ||
<script> | ||
$(".no_reviewed_entities").hide(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With javascript it's a good idea to run commands only after the full page has loaded. You can use document.ready here:
$(document).ready(function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 OK by me, pending feedback from @gentlecat
<div class="col-sm-4"> | ||
<div> | ||
<input type="checkbox" name="only-reviewed" value="1" id="only-reviewed"/> | ||
{{ _('Only show releases with reviews') }}<br/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Artist page doesn't have releases. Only release groups.
} | ||
}) | ||
}) | ||
</script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to put this JS code into a separate script in static/scripts, build and import it.
Also please don't forget to assign yourself to the issue in JIRA and mark it as WIP so that there's no confusion if someone else decides to work on it. |
On the last screenshot there's a "Next" button. Is that a bug or the screenshot is just a prototype? |
The "Next" Button appeared as the filtering was being done on just that page. So, as there were no more reviewed entities (on that page), the "Next Button" appeared. I've fixed this and now all reviewed release groups are shown together. I've rebased the present branch and based it on PR #140. I've modified the code to fix the problem by fetching all release groups of an artist by directly using the db. |
to single pages Use direct db access, make use of js for next, previous links
Was trying to test this and ran into the following issue:
|
I'm seeing this on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main problem here is that you removed pagination from the release group retrieval. Even if most artists don't have many, some pages will probably be slowed down significantly the more release groups they have.
If this is not the case, I'd like to at least see some proof.
That is correct. Some pages slow down as they have many release groups (Various Artists page (no. of release groups: 145133), for instance). But fetching all release groups is important if all reviewed release groups are to be shown together. Some possible (though probably not the best) work-arounds on frontend can be:
I am unsure if either is a good choice. Please suggest. Thanks! |
@ferbncode, I'd like to discuss how exactly to move forward on this, once you get the time. |
Closing this for now so that discussion can be moved to the ticket: https://tickets.metabrainz.org/browse/CB-84?focusedCommentId=45384&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-45384 |
Added checkbox on artist discography pages to filter only those releases (on that page) which have reviews.
To fetch only those releases which have a review (rather than filtering on that page), I guess we can later fetch all releases (rather than applying the limit) and then show them (shouldn't slow down the page).