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
Conversation
Add redirect using revision id to review/rev page and add links of revision buttons in reports page.
@@ -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): |
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.
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) |
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 probably a good idea to catch NoDataFoundException
in case revision is not found.
critiquebrainz/db/revision.py
Outdated
id | ||
FROM revision | ||
WHERE review_id = :review_id) | ||
AS indexedrevisions |
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.
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.
Add redirect using
revision id
toreview/revisions/rev
page and add links ofrevision
buttons inreport_results
page.