computeCommentCounts function

Map<String, int> computeCommentCounts(
  1. Iterable<ReviewComment> comments
)

Computes open, resolved, and total counts for comments.

Implementation

Map<String, int> computeCommentCounts(Iterable<ReviewComment> comments) {
  var open = 0;
  var resolved = 0;
  for (final item in comments) {
    if (item.status == 'resolved') {
      resolved++;
    } else {
      open++;
    }
  }
  return {'open': open, 'resolved': resolved, 'total': open + resolved};
}