-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathgitlab_total_issues_open
executable file
·37 lines (28 loc) · 1.07 KB
/
gitlab_total_issues_open
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python
from lib import get_gitlab_instance
import sys
if len(sys.argv) >= 2 and sys.argv[1] == 'config':
print('graph_title GitLab open issues')
print('graph_vlabel issues')
print('graph_args -l 0')
print('graph_category gitlab')
print('unassigned.label unassigned')
print('unassigned.draw AREA')
print('unassigned.colour BCFFBC')
print('assigned.label assigned')
print('assigned.draw STACK')
print('assigned.colour 00FF00')
sys.exit(0)
gitlab = get_gitlab_instance()
db = gitlab.get_db_connection()
cursor = db.cursor()
cursor.execute("SELECT COUNT(*) FROM issues i LEFT JOIN issue_assignees ia ON i.id = ia.issue_id WHERE i.state_id = 1 AND ia.user_id IS NULL")
unassigned = cursor.fetchone()[0]
cursor.close()
cursor = db.cursor()
cursor.execute("SELECT COUNT(*) FROM issues i LEFT JOIN issue_assignees ia ON i.id = ia.issue_id WHERE i.state_id = 1 AND ia.user_id IS NOT NULL")
assigned = cursor.fetchone()[0]
cursor.close()
db.close()
print('unassigned.value ' + str(unassigned))
print('assigned.value ' + str(assigned))