Skip to content

Commit 8201531

Browse files
pluehnelarsxschneider
authored andcommitted
Switch user activity chart to 4-week intervals (#135)
The user activity chart stems from before most sliding windows and aggregation methods were switched from 30-day intervals to 4-week intervals. The benefit of this is that weekends are evened out, which avoids accidentally misinterpreting some fluctuations. This changes the user activity chart accordingly for consistency. Additionally, the time range computation in the updater report receives a minor refactoring based on the more recent reports. Note that this change will invalidate previously recorded data based on 30-day intervals. However, no action is taken, because the difference between data aggregated over 28 and 30 days is expected to be subtle.
1 parent 4f91a21 commit 8201531

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

docs/demo-data/users.tsv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
date pushing commits (last day) pushing commits (last week) pushing commits (last month) using license
1+
date pushing commits (last day) pushing commits (last week) pushing commits (last four weeks) using license
22
2017-09-25 104 184 235 330
33
2017-09-24 13 182 234 326
44
2017-09-23 12 181 238 325

docs/users-activity.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ <h3>Users (Active/Using License)</h3>
1919
"series":
2020
[
2121
"using license",
22-
"pushing commits (last month)",
22+
"pushing commits (last four weeks)",
2323
"pushing commits (last week)",
2424
"pushing commits (last day)"
2525
],
2626
"visibleSeries":
2727
[
2828
"using license",
29-
"pushing commits (last month)"
29+
"pushing commits (last four weeks)"
3030
],
3131
"slice": [0, 61]
3232
},
@@ -41,14 +41,14 @@ <h3>Users (Active/Using License)</h3>
4141
"series":
4242
[
4343
"using license",
44-
"pushing commits (last month)",
44+
"pushing commits (last four weeks)",
4545
"pushing commits (last week)",
4646
"pushing commits (last day)"
4747
],
4848
"visibleSeries":
4949
[
5050
"using license",
51-
"pushing commits (last month)"
51+
"pushing commits (last four weeks)"
5252
],
5353
"slice": [0, 106],
5454
"default": true
@@ -64,14 +64,14 @@ <h3>Users (Active/Using License)</h3>
6464
"series":
6565
[
6666
"using license",
67-
"pushing commits (last month)",
67+
"pushing commits (last four weeks)",
6868
"pushing commits (last week)",
6969
"pushing commits (last day)"
7070
],
7171
"visibleSeries":
7272
[
7373
"using license",
74-
"pushing commits (last month)"
74+
"pushing commits (last four weeks)"
7575
]
7676
}
7777
]
@@ -81,7 +81,7 @@ <h3>Users (Active/Using License)</h3>
8181
<i>Using license</i> shows how many GitHub Enterprise licenses were used at a given date.
8282
</p>
8383
<p>
84-
<i>Pushing commits</i> corresponds to how many different people pushed commits to the appliance in the last month, week, or day.
84+
<i>Pushing commits</i> corresponds to how many different people pushed commits to the appliance in the last four weeks, week, or day.
8585
</p>
8686
</div>
8787
<div class="info-box">

updater/reports/ReportUsers.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
from .ReportDaily import *
22

3-
# Lists how many users pushed commits vs. how many used a seat in the last day, week, and month
3+
# Lists how many users pushed commits vs. how many used a seat in the last day, week, and four weeks
44
class ReportUsers(ReportDaily):
55
def name(self):
66
return "users"
77

88
def updateDailyData(self):
9-
self.header, newData = self.parseData(self.executeQuery(self.query(self.yesterday())))
9+
self.header, newData = self.parseData(self.executeQuery(self.query()))
1010
self.data.extend(newData)
1111
self.truncateData(self.timeRangeTotal())
1212
self.sortDataByDate()
@@ -36,20 +36,20 @@ def usersUsingSeatSubquery(self):
3636
users.suspended_at IS NULL'''
3737

3838
# Collects the number of pushing users and users using a seat
39-
def query(self, date):
40-
# Also compute the stats for a 7-day and a 30-day period
41-
sevenDaysEarlier = date - datetime.timedelta(6)
42-
thirtyDaysEarlier = date - datetime.timedelta(29)
39+
def query(self):
40+
oneDayAgo = self.yesterday()
41+
oneWeekAgo = self.daysAgo(7)
42+
fourWeeksAgo = self.daysAgo(28)
4343

4444
return '''
4545
SELECT
46-
"''' + str(date) + '''" AS date,
46+
"''' + str(oneDayAgo) + '''" AS date,
4747
usersPushingYesterday.count AS "pushing commits (last day)",
4848
usersPushingLastWeek.count AS "pushing commits (last week)",
49-
usersPushingLastMonth.count AS "pushing commits (last month)",
49+
usersPushingLastFourWeeks.count AS "pushing commits (last four weeks)",
5050
usersUsingSeat.count AS "using license"
5151
FROM
52-
(''' + self.usersPushingSubquery([date, date]) + ''') AS usersPushingYesterday,
53-
(''' + self.usersPushingSubquery([sevenDaysEarlier, date]) + ''') AS usersPushingLastWeek,
54-
(''' + self.usersPushingSubquery([thirtyDaysEarlier, date]) + ''') AS usersPushingLastMonth,
52+
(''' + self.usersPushingSubquery([oneDayAgo, oneDayAgo]) + ''') AS usersPushingYesterday,
53+
(''' + self.usersPushingSubquery([oneWeekAgo, oneDayAgo]) + ''') AS usersPushingLastWeek,
54+
(''' + self.usersPushingSubquery([fourWeeksAgo, oneDayAgo]) + ''') AS usersPushingLastFourWeeks,
5555
(''' + self.usersUsingSeatSubquery() + ''') AS usersUsingSeat'''

0 commit comments

Comments
 (0)