Uploaded image for project: 'CritiqueBrainz'
  1. CritiqueBrainz
  2. CB-382

You can sometimes create a review without a revision

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • v-2020-10-09.0
    • None
    • None
    • None

      Based on this TODO: https://github.com/metabrainz/critiquebrainz/blob/bc3ba65c3074d52a3c3526438edd4985c5f57c96/critiquebrainz/db/review.py#L323

      I've encountered a few issues when doing various operations that cause a problem because the review creation code isn't done in a transaction (CB-372, CB-382). 

      If for whatever reason a review object is created but not a revision, the get_reviews_list method returns a tuple (count, revisions), where count is 1 (number of review objects), but there are no revisions. This causes this kind of check to fail: https://github.com/metabrainz/critiquebrainz/blob/3dc43bacb31feb33be18e94984e975d8ddd49161/critiquebrainz/frontend/views/release_group.py#L69

      We should do the following items:

      • Save the review/revision in the same transaction
      • Perform a check to see if there are any cases in the database where this situation has occurred
      • Decide how we should work around this issue in the future if it occurs
        • In get_reviews_list,  join review against revision in order to ensure that there is a revision set. However, this means that we'd also have to support the case of creating only a revision when a review already exists. We should check if the places that use this method expect this kind of return value.
        • Improve the check in the frontend view, to check both if there is a review count and a list of revisions set before accessing it.

            kartik1712 amCap1712
            alastairp Alastair Porter
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                Version Package
                v-2020-10-09.0