-
Notifications
You must be signed in to change notification settings - Fork 47
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
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> |
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 | ||
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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
''' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
There was a problem hiding this comment.
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?