Skip to content

Commit

Permalink
new chart for organization total and teams total
Browse files Browse the repository at this point in the history
  • Loading branch information
Todd O'Connor authored and larsxschneider committed Nov 20, 2017
1 parent c782eee commit 90f10b7
Show file tree
Hide file tree
Showing 9 changed files with 145 additions and 2 deletions.
9 changes: 8 additions & 1 deletion docs/_data/navigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@
- title: "Total"
url: "/repos-total"
- title: "Organizations"
url: "/org-owners"
url: "/orgs-total"
subnavigation:
- title: "Total"
url: "/orgs-total"
- title: "Owners"
url: "/org-owners"
- title: "Teams"
url: "/teams-total"
- title: "Housekeeping"
url: "/housekeeping-git-traffic"
subnavigation:
Expand Down
13 changes: 13 additions & 0 deletions docs/demo-data/orgs-total.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
date total
2017-09-25 923
2017-09-24 926
2017-09-23 930
2017-09-22 929
2017-09-21 928
2017-09-20 927
2017-09-19 926
2017-09-18 924
2017-09-17 922
2017-09-16 918
2017-09-15 916
2017-09-14 909
13 changes: 13 additions & 0 deletions docs/demo-data/teams-total.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
date total
2017-09-25 579
2017-09-24 575
2017-09-23 578
2017-09-22 574
2017-09-21 572
2017-09-20 566
2017-09-19 556
2017-09-18 548
2017-09-17 541
2017-09-16 533
2017-09-15 524
2017-09-14 511
26 changes: 26 additions & 0 deletions docs/orgs-total.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
layout: default
title: Organizations
permalink: /orgs-total
---

<h3>Organizations (Total)</h3>

<div class="row">
<div class="col-main">
<div class="chart-container">
<canvas
class="chart"
data-url="{{ site.dataURL }}/orgs-total.tsv"
data-type="history"
></canvas>
</div>
</div>
<div class="col-aside">
<div class="info-box">
<p>
The number of organizations in total.
</p>
</div>
</div>
</div>
26 changes: 26 additions & 0 deletions docs/teams-total.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
layout: default
title: Teams
permalink: /teams-total
---

<h3>Teams (Total)</h3>

<div class="row">
<div class="col-main">
<div class="chart-container">
<canvas
class="chart"
data-url="{{ site.dataURL }}/teams-total.tsv"
data-type="history"
></canvas>
</div>
</div>
<div class="col-aside">
<div class="info-box">
<p>
The number of teams in total.
</p>
</div>
</div>
</div>
2 changes: 1 addition & 1 deletion updater/config.py.example
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ configuration = \
# then define that here to exclude them from all kinds of statistics.
# "github-enterprise" is a default organization in GitHub Enterprise that
# we exclude here, too (Note: this also excludes repositories with the name
" "github-enterprise").
# "github-enterprise").
"excludedEntities":
[
"github-enterprise",
Expand Down
27 changes: 27 additions & 0 deletions updater/reports/ReportOrgsTotal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from .ReportDaily import *

# Lists the total number of organizations
class ReportOrgsTotal(ReportDaily):
def name(self):
return "orgs-total"

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()

def query(self):
query = '''
SELECT
"''' + str(self.yesterday()) + '''" AS date,
COUNT(*) AS total
FROM
users AS orgs
WHERE
orgs.type = "Organization" ''' + \
self.andExcludedEntities("orgs.login")
return query
27 changes: 27 additions & 0 deletions updater/reports/ReportTeamsTotal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from .ReportDaily import *

# Lists the total number of organizations
class ReportTeamsTotal(ReportDaily):
def name(self):
return "teams-total"

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()

def query(self):
query = '''
SELECT
"''' + str(self.yesterday()) + '''" AS date,
COUNT(*) AS total
FROM
teams, users AS orgs
WHERE
teams.organization_id = orgs.id ''' + \
self.andExcludedEntities("orgs.login")
return query
4 changes: 4 additions & 0 deletions updater/update-stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
from reports.ReportGitVersions import *
from reports.ReportOrgCollaboration import *
from reports.ReportOrgOwners import *
from reports.ReportOrgsTotal import *
from reports.ReportPRByOrg import *
from reports.ReportPRByRepo import *
from reports.ReportPRHistory import *
from reports.ReportPRUsage import *
from reports.ReportRepoActivity import *
from reports.ReportRepositoryHistory import *
from reports.ReportTeamsTotal import *
from reports.ReportTokenlessAuth import *
from reports.ReportUsers import *

Expand Down Expand Up @@ -78,12 +80,14 @@ def main():
ReportGitVersions(configuration, dataDirectory, metaStats).update()
ReportOrgCollaboration(configuration, dataDirectory, metaStats).update()
ReportOrgOwners(configuration, dataDirectory, metaStats).update()
ReportOrgsTotal(configuration, dataDirectory, metaStats).update()
ReportPRByOrg(configuration, dataDirectory, metaStats).update()
ReportPRByRepo(configuration, dataDirectory, metaStats).update()
ReportPRHistory(configuration, dataDirectory, metaStats).update()
ReportPRUsage(configuration, dataDirectory, metaStats).update()
ReportRepoActivity(configuration, dataDirectory, metaStats).update()
ReportRepositoryHistory(configuration, dataDirectory, metaStats).update()
ReportTeamsTotal(configuration, dataDirectory, metaStats).update()
ReportTokenlessAuth(configuration, dataDirectory, metaStats).update()
ReportUsers(configuration, dataDirectory, metaStats).update()

Expand Down

0 comments on commit 90f10b7

Please sign in to comment.