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

Link "Read revision" buttons in reports page. #85

Merged
merged 2 commits into from Mar 7, 2017

Conversation

ferbncode
Copy link
Member

Add redirect using revision id to review/revisions/rev page and add links of revision buttons in report_results page.

Add redirect using revision id to review/rev page
and add links of revision buttons in reports page.
@ferbncode ferbncode changed the title Link Revision Buttons in reports page. Link "Read revision" buttons in reports page. Mar 5, 2017
@@ -90,6 +90,10 @@ def entity(id, rev=None):
other_reviews = user_all_reviews[:3]
return render_template('review/entity/%s.html' % review.entity_type, review=review, spotify_mappings=spotify_mappings, soundcloud_url=soundcloud_url, vote=vote, other_reviews=other_reviews)

@review_bp.route('/<uuid:id>/revision/<int:rev_id>')
def redirect_to_entity(id, rev_id):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rev_id can be interpreted as "review id" or "revision id". It's better to make both arguments explicit: review_id, revision_id.

@@ -90,6 +90,10 @@ def entity(id, rev=None):
other_reviews = user_all_reviews[:3]
return render_template('review/entity/%s.html' % review.entity_type, review=review, spotify_mappings=spotify_mappings, soundcloud_url=soundcloud_url, vote=vote, other_reviews=other_reviews)

@review_bp.route('/<uuid:id>/revision/<int:rev_id>')
def redirect_to_entity(id, rev_id):
rev_num = db_revision.get_revision_number(id, rev_id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably a good idea to catch NoDataFoundException in case revision is not found.

id
FROM revision
WHERE review_id = :review_id)
AS indexedrevisions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nitpick. I think it will look a bit better like this:

FROM (
    SELECT row_number() over(order by timestamp),
           id
      FROM revision
     WHERE review_id = :review_id
) AS indexed_revisions
WHERE id = :revision_id

:)

Indentation fixes, proper args usage in redirect_to_entity view
and catch exception in view for redirect function.
@gentlecat gentlecat merged commit 9e0d2c0 into metabrainz:master Mar 7, 2017
@ferbncode ferbncode deleted the redirect-revision-id branch March 7, 2017 16:55
@ferbncode ferbncode restored the redirect-revision-id branch March 7, 2017 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants