Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Tickets graphs? #17

Open
icco opened this issue Sep 28, 2010 · 2 comments
Open

Change Tickets graphs? #17

icco opened this issue Sep 28, 2010 · 2 comments

Comments

@icco
Copy link
Contributor

icco commented Sep 28, 2010

http://cl.ly/2Zxq and http://cl.ly/2aXh

Our developers accept tickets when they are working on them, but this graph seems not as useful as it could be.

My suggestion would be show the difference of closed tickets versus open tickets.

@icco
Copy link
Contributor Author

icco commented Sep 28, 2010

I would also suggest adding graphs like there is for code, with tickets filed by hour and day.

@knarrff
Copy link

knarrff commented Sep 19, 2011

I quickly hacked what this ticket asks for (not recommended directly for upstream - you might want to have that configurable), but I could not figure out how to add attachments here, so I just paste the patch here:

diff --git a/tracstats/templates/tickets.html b/tracstats/templates/tickets.html
index dbe1f13..a250917 100644
--- a/tracstats/templates/tickets.html
+++ b/tracstats/templates/tickets.html
@@ -40,7 +40,7 @@
 <py:if test="history">
 <br />

-<h2>Open Tickets</h2>
+<h2>Closed/Open Tickets</h2>

 <div id="opentickets" style="width:600px;height:300px;"></div>

@@ -55,14 +55,14 @@ $(function () {
     };


-    var d1 = [<py:for each="i in range(len(history))">[${history[i].x}, ${history[i].opened}]<py:if
-                      test="i != len(history)-1">,[${history[i+1].x}, ${history[i].opened}],</py:if
+    var d1 = [<py:for each="i in range(len(history))">[${history[i].x}, ${history[i].closed}]<py:if
+                      test="i != len(history)-1">,[${history[i+1].x}, ${history[i].closed}],</py:if

-    var d2 = [<py:for each="i in range(len(history))">[${history[i].x}, ${history[i].accepted}]<py:
-                      test="i != len(history)-1">,[${history[i+1].x}, ${history[i].accepted}],</py:
+    var d2 = [<py:for each="i in range(len(history))">[${history[i].x}, ${history[i].opened}]<py:if
+                      test="i != len(history)-1">,[${history[i+1].x}, ${history[i].opened}],</py:if

-    $.plot($("#opentickets"), [ { data: d1, label: 'Open' },
-                                { data: d2, label: 'Accepted' } ], options);
+    $.plot($("#opentickets"), [ { data: d1, label: 'Closed' },
+                                { data: d2, label: 'Opened' } ], options);
 });
 </script>
 </py:if>
diff --git a/tracstats/web_ui.py b/tracstats/web_ui.py
index fe976b6..3129ba9 100644
--- a/tracstats/web_ui.py
+++ b/tracstats/web_ui.py
@@ -1071,6 +1071,7 @@ class TracStatsPlugin(Component):
             d = {}
             opened = 0
             accepted = 0
+            closed = 0
             for ticket, t, oldvalue, newvalue in sorted(rows, key=itemgetter(1)):
                 if newvalue == 'accepted' and oldvalue != 'accepted':
                     accepted += 1
@@ -1080,13 +1081,18 @@ class TracStatsPlugin(Component):
                     opened += 1
                 elif newvalue == "closed" and oldvalue != "closed":
                     opened -= 1
-                d[int(t)] = (opened, accepted)
+                if newvalue == 'closed' and oldvalue != 'closed':
+                    closed += 1
+                elif newvalue != 'closed' and oldvalue == 'closed':
+                    closed -= 1
+                d[int(t)] = (opened, accepted, closed)
             steps = max(len(d) / 250, 1)
             for k, v in sorted(d.iteritems(), key=itemgetter(0))[::steps]:
                 if k > since:
                     stats.append({'x': k * 1000,
                                   'opened': v[0],
-                                  'accepted': v[1],})
+                                  'accepted': v[1],
+                                  'closed': v[2],})
         data['history'] = stats

         cursor.execute("""\

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants