Add Issue Status and Counts to Dashboard

Review Request #3949 — Created March 8, 2013 and discarded — Latest diff uploaded

Information

Review Board

Reviewers

This patch adds support for showing the following in the dashboard as well as "All Review Request" Pages
a) The issue count in the format of <open issues> / <total issues>
b) Status of a review request:
   + If there are no open issues and a shipit, it shows up with a green background and the shipit icon
   + If there are open issues and a shipit, it shows up with a red background and an exclamation sign.
    
In addition, the review detail page shows the "ship it" emblem if there are no issues and a "ship it with issues" emblem if there are issues and a ship-it.
    
Summary of changes:
* reviewboard/reviews/datagrids.py
  + Added StatusColumn as a non-sortable(as there will be issues and ship it counts) column.
  + Added IssueCount column as a sortable column that displays the issue count in the format of <open issues> / <total issues>
    
* reviewboard/reviews/evolutions/issue_status_count.py
  + Added migration scripts to add issue_{open,closed,total}_count to the reviews_reviewrequest table.
    
* reviewboard/reviews/fixtures/test_reviewrequests.json
  + Added init values for issue counts in the review request fixtures.
    
* reviewboard/reviews/managers.py
  + Added methods to calculate the issue open, closed and total counts for existing review requests. These will be calculated for review requests when they are accessed the first time.
  + Added methods to calculate the issue open, closed and total count for a new review. These will be called when a new review is published
    
* reviewboard/reviews/models.py
  + Added initializer fields for issue_{open,closed,total}_count.
  + Since issue states can be modified by just a PUT request (and no need for a publish after that), check the old and new states when a comment is saved. Only if an issue is opened and the states change, increment/decrement the issue counts.
  + Calculate the issue counts when a review is published.
    
* reviewboard/reviews/tests.py
  + Added couple of tests where all types of comments (screenshot, attachment, diff) are added, issues created against them and closed. The issue counts are verified at every stage.
    
* reviewboard/templates/reviews/review_detail.html
  + Modified the review_detail template to show "ship it" or "ship it with issues" depending on whether there are open issues with a Ship It.
    
* reviewboard/webapi/resources.py
  + Added issue_open_count and issue_total_count when GET-ting a ReviewRequestResource
  + Provide filtering capabilities so open-issues can be queried when getting a list of review-requests
    
* reviewboard/webapi/tests.py
  + Modified couple of tests related to creating issues to include issue counts and verified whether the counts are appearing properly.

Note: The djblets changes associated with this are in review request 3948
Manual testing as well as running the test suite with additional tests. Also tested webapi resources manually and through the webapi tests.