Comment by ~aparcar on ~aparcar/openwrt-bugs-import-test-2
Manually adding a comment should increase
comment_count
correctly.
Comment by ~aparcar on ~sircmpwn/todo.sr.ht
Correction, something like the following could do a better job. I'll setup a test instance and report back:
diff --git a/todosrht/tracker_import.py b/todosrht/tracker_import.py index fd89311..e68a59f 100644 --- a/todosrht/tracker_import.py +++ b/todosrht/tracker_import.py @@ -70,6 +70,7 @@ def _import_comment(ticket, event, edata): comment.authenticity = TicketAuthenticity.authentic else: comment.authenticity = TicketAuthenticity.tampered + ticket.comment_count += 1 db.session.add(comment) db.session.flush() event.comment_id = comment.id
Comment by ~aparcar on ~sircmpwn/todo.sr.ht
Problem is ticket comments are stored as an integer and the import doesn't set that value automatically. Looking at the migration code it looks like after every import something like this should run:
UPDATE ticket t SET comment_count = ( SELECT count(*) FROM ticket_comment WHERE ticket_id = t.id AND superceeded_by_id IS NULL )
Ticket created by ~aparcar on ~aparcar/openwrt-bugs-import-test-2
Here we go a test for testing.
Ticket created by ~aparcar on ~sircmpwn/todo.sr.ht
I imported a number of tickets exported from a flyspray(.org) tracker and while successful, the overview doesn't show the number of comments per ticket.
The affected todo tracker is ~aparcar/openwrt-bugs-import-test-2. The very first ticket show no (0) comments in the overview while there is actually one.