On 02/26/2016 09:54 PM, Angel Ezquerra wrote:
diff --git a/kallithea/model/db.py b/kallithea/model/db.py
--- a/kallithea/model/db.py
+++ b/kallithea/model/db.py
@@ -1389,6 +1389,16 @@
grouped[cmt.revision].append(cmt)
return grouped
+ def count_comments(self, comments):
+ """
+ Returns the count of (non-empty) comments for this repository grouped
by revisions
+
+ :param comments: a {revision: comment} dict, as returned by
get_comments()
+ """
+ def count_revision_comments(revision_comments):
+ return len([cm for cm in revision_comments if cm.text])
+ return {raw_id: count_revision_comments(revision_comments) for raw_id,
revision_comments in comments.iteritems()}
get_comments will sometimes return a list ... which doesn't have .iteritems.
That is a flaw which so far hasn't been fatal. I will fix that. But it
shows very little local testing of this change ... and that the test
suite hasn't been run.
Also, working with PRs will also end up with calling compare_cs.html ...
and crash.
/Mads
_______________________________________________
kallithea-general mailing list
[email protected]
http://lists.sfconservancy.org/mailman/listinfo/kallithea-general