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

Chart: total number of organizations and teams #39

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/_data/navigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
url: "/repos-total"
- title: "Organizations"
url: "/org-owners"
subnavigation:
- title: "Owners"
url: "/org-owners"
- title: "Total"
url: "/org-total"
- title: "Housekeeping"
url: "/housekeeping-git-traffic"
subnavigation:
Expand Down
13 changes: 13 additions & 0 deletions docs/demo-data/org-history.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
date total teams
2017-09-25 923 579
2017-09-24 926 575
2017-09-23 930 578
2017-09-22 929 574
2017-09-21 928 572
2017-09-20 927 566
2017-09-19 926 556
2017-09-18 924 548
2017-09-17 922 541
2017-09-16 918 533
2017-09-15 916 524
2017-09-14 909 511
35 changes: 35 additions & 0 deletions docs/org-total.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
layout: default
title: Organizations
permalink: /org-total
---

<h3>Organizations (Total)</h3>

<div class="row">
<div class="col-main">
<div class="chart-container">
<canvas
class="chart"
data-url="{{ site.dataURL }}/org-history.tsv"
data-type="history"
data-config='{
"series": [
"total",
"teams"
],
"visibleSeries": [
"total"
]
}'
></canvas>
</div>
</div>
<div class="col-aside">
<div class="info-box">
<p>
The number of organizations in total, and the number of teams in total.
</p>
</div>
</div>
</div>
55 changes: 55 additions & 0 deletions updater/reports/ReportOrgHistory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
from .ReportDaily import *

# Lists the total number of organizations
class ReportOrgHistory(ReportDaily):
def name(self):
return "org-history"

def updateDailyData(self):
newHeader, newData = self.parseData(
self.executeQuery(self.query())
)
self.header = newHeader if newHeader else self.header
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.header is not previously defined. Therefore, we would not set anything in the else part, right?

self.data.extend(newData)
self.truncateData(self.timeRangeTotal())
self.sortDataByDate()

# Collects the number of organizations
def subquery(self, userType):
query = '''
SELECT
COUNT(*) AS count
FROM
users
WHERE
users.type = "Organization"
AND
users.login <> "github-enterprise"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! We need to ignore this invalid organization in other reports, too. I think it would be easiest to hard code "github-enterprise" to https://github.com/Autodesk/hubble/blob/master/updater/reports/Report.py#L198-L210

//cc @pluehne ?

'''

return query

# Collects the number of teams
def totalTeamsQuery(self, userType):
query = '''
SELECT
COUNT(*) AS count
FROM
teams
'''
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't that the total number of teams? Don't we want to know the number of teams per org here?
I dunno if we should mix that into this repo. @pluehne ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I hit "send", I realized you really want to count the total number of teams here 😄


return query

# Collects the number of organizations in total, and the number of teams in total
def query(self):
query = '''
SELECT
"''' + str(self.yesterday()) + '''" AS date,
total.count AS total,
teamsTotal.count AS teams
FROM
(''' + self.subquery(None) + ''') AS total,
(''' + self.totalTeamsQuery(None) + ''') AS teamsTotal
'''

return query
2 changes: 2 additions & 0 deletions updater/update-stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from reports.ReportGitRequests import *
from reports.ReportGitVersions import *
from reports.ReportOrgCollaboration import *
from reports.ReportOrgHistory import *
from reports.ReportOrgOwners import *
from reports.ReportPRByOrg import *
from reports.ReportPRByRepo import *
Expand Down Expand Up @@ -77,6 +78,7 @@ def main():
ReportGitRequests(configuration, dataDirectory, metaStats).update()
ReportGitVersions(configuration, dataDirectory, metaStats).update()
ReportOrgCollaboration(configuration, dataDirectory, metaStats).update()
ReportOrgHistory(configuration, dataDirectory, metaStats).update()
ReportOrgOwners(configuration, dataDirectory, metaStats).update()
ReportPRByOrg(configuration, dataDirectory, metaStats).update()
ReportPRByRepo(configuration, dataDirectory, metaStats).update()
Expand Down