File tree Expand file tree Collapse file tree 5 files changed +55
-2
lines changed
Expand file tree Collapse file tree 5 files changed +55
-2
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ class hasTimes extends Base {
1515 constructor ( config ) {
1616 super ( config ) ;
1717 this . times = [ ] ;
18+ this . fullNames = { } ;
1819 }
1920
2021 /**
@@ -101,6 +102,7 @@ class hasTimes extends Base {
101102 // add to time spent & add to user specific time spent
102103 timeSpent += time . seconds ;
103104 timeUsers [ note . author . username ] += time . seconds ;
105+ this . fullNames [ note . author . username ] = note . author . name ;
104106
105107 time . project_namespace = this . project_namespace ;
106108 times . push ( time ) ;
Original file line number Diff line number Diff line change @@ -67,4 +67,4 @@ class project extends Base {
6767 }
6868}
6969
70- module . exports = project ;
70+ module . exports = project ;
Original file line number Diff line number Diff line change 1+ const _ = require ( 'underscore' ) ;
2+
3+ /**
4+ * user model
5+ */
6+ class user {
7+ constructor ( data = { } ) {
8+ this . data = data ;
9+ }
10+
11+ make ( username ) {
12+ let promise ;
13+
14+ promise = this . get ( `users?username=${ username } ` ) ;
15+
16+ promise . then ( user => {
17+ this . data = user . body ;
18+ return promise ;
19+ } ) ;
20+
21+ return promise ;
22+ }
23+
24+ /*
25+ * properties
26+ */
27+
28+ get id ( ) {
29+ return this . data . id ;
30+ }
31+
32+ get name ( ) {
33+ return this . data . name ;
34+ }
35+
36+ get state ( ) {
37+ return this . data . state === "active" ? true : false ;
38+ }
39+
40+ get avatar_url ( ) {
41+ return this . data . avatar_url ;
42+ }
43+
44+ get web_url ( ) {
45+ return this . data . web_url ;
46+ }
47+ }
Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ class base {
101101 let totalSpent = 0 ;
102102 let spent = 0 ;
103103 let users = { } ;
104+ let userNames = { } ;
104105 let projects = { } ;
105106 let times = [ ] ;
106107
@@ -110,6 +111,7 @@ class base {
110111 if ( ! users [ time . user ] ) users [ time . user ] = 0 ;
111112 if ( ! projects [ time . project_namespace ] ) projects [ time . project_namespace ] = 0 ;
112113
114+ userNames [ time . user ] = issue . fullNames [ time . user ] ;
113115 users [ time . user ] += time . seconds ;
114116 projects [ time . project_namespace ] += time . seconds ;
115117
@@ -142,6 +144,7 @@ class base {
142144 this . users = userArr ;
143145
144146 this . projects = _ . mapObject ( projects , project => this . config . toHumanReadable ( project , 'stats' ) ) ;
147+ this . userNames = userNames ;
145148 this . stats = {
146149 'total estimate' : this . config . toHumanReadable ( totalEstimate , 'stats' ) ,
147150 'total spent' : this . config . toHumanReadable ( totalSpent , 'stats' ) ,
Original file line number Diff line number Diff line change @@ -31,7 +31,8 @@ class markdown extends Base {
3131 }
3232
3333 for ( let [ name , time , seconds ] of this . users ) {
34- stats += `\n* **${ name } **: ${ time } ` ;
34+ let fullName = this . userNames [ name ] ;
35+ stats += `\n* **${ fullName } **: ${ time } ` ;
3536 }
3637
3738 this . write ( stats . substr ( 1 ) ) ;
You can’t perform that action at this time.
0 commit comments