@@ -4,6 +4,7 @@ var sprintf = require('sprintf-js').sprintf;
44var _ = require ( 'underscore' ) ;
55
66var chalk = require ( '../chalk' ) ;
7+ var icon = require ( '../icon' ) ;
78var log = require ( '../log' ) ;
89var core = require ( '../core' ) ;
910var session = require ( '../session' ) ;
@@ -79,18 +80,12 @@ function showProgress(problems) {
7980 printLine ( 'Hard' , stats . hard . ac , stats . hard . all ) ;
8081}
8182
82- const CHARS = {
83- ac : h . isWindows ( ) ? 'O ' : '▣ ' ,
84- notac : h . isWindows ( ) ? 'X ' : '▤ ' ,
85- none : h . isWindows ( ) ? 'o ' : '⬚ ' ,
86- } ;
87-
8883function showGraph ( problems ) {
8984 const ICONS = {
90- ac : chalk . green ( CHARS . ac ) ,
91- notac : chalk . red ( CHARS . notac ) ,
92- none : chalk . gray ( CHARS . none ) ,
93- empty : ' '
85+ ac : chalk . green ( icon . ac ) ,
86+ notac : chalk . red ( icon . notac ) ,
87+ none : chalk . gray ( icon . none ) ,
88+ empty : icon . empty
9489 } ;
9590
9691 // row header is 4 bytes
@@ -101,9 +96,9 @@ function showGraph(problems) {
10196 if ( groups > 5 ) groups = 5 ;
10297
10398 const header = _ . range ( groups )
104- . map ( x => sprintf ( '%5d %18d' , x * 10 + 1 , x * 10 + 10 ) )
99+ . map ( x => sprintf ( '%4d %18d' , x * 10 + 1 , x * 10 + 10 ) )
105100 . join ( '' ) ;
106- log . info ( ' ' + header ) ;
101+ log . info ( ' ' + header ) ;
107102
108103 const graph = [ ] ;
109104 for ( let problem of problems )
@@ -112,33 +107,33 @@ function showGraph(problems) {
112107 let line = [ sprintf ( ' %03d' , 0 ) ] ;
113108 for ( let i = 1 , n = graph . length ; i <= n ; ++ i ) {
114109 // padding before group
115- if ( i % 10 === 1 ) line . push ( ' ' ) ;
110+ if ( i % 10 === 1 ) line . push ( ' ' ) ;
116111
117112 line . push ( graph [ i ] || ICONS . empty ) ;
118113
119114 // time to start new row
120115 if ( i % ( 10 * groups ) === 0 || i === n ) {
121- log . info ( line . join ( '' ) ) ;
116+ log . info ( line . join ( ' ' ) ) ;
122117 line = [ sprintf ( ' %03d' , i ) ] ;
123118 }
124119 }
125120
126121 log . info ( ) ;
127122 log . printf ( '%7s%s%3s%s%3s%s' ,
128- ' ' , ICONS . ac + chalk . green ( ' Accepted' ) ,
129- ' ' , ICONS . notac + chalk . red ( ' Not Accepted' ) ,
130- ' ' , ICONS . none + ' Remaining' ) ;
123+ ' ' , ICONS . ac + chalk . green ( ' Accepted' ) ,
124+ ' ' , ICONS . notac + chalk . red ( ' Not Accepted' ) ,
125+ ' ' , ICONS . none + ' Remaining' ) ;
131126}
132127
133128function showCal ( ) {
134129 const MONTHS = [ 'Jan' , 'Feb' , 'Mar' , 'Apr' , 'May' , 'Jun' , 'Jul' , 'Aug' , 'Sep' , 'Oct' , 'Nov' , 'Dec' ] ;
135130 const WEEKDAYS = [ 'Sun' , 'Mon' , 'Tue' , 'Wed' , 'Thu' , 'Fri' , 'Sat' ] ;
136131 const ICONS = [
137- CHARS . none ,
138- chalk . sprint ( CHARS . ac , '#ffffcc' ) ,
139- chalk . sprint ( CHARS . ac , '#ccff66' ) ,
140- chalk . sprint ( CHARS . ac , '#66cc33' ) ,
141- chalk . sprint ( CHARS . ac , '#00ff00' )
132+ icon . none ,
133+ chalk . white ( icon . ac ) ,
134+ chalk . green ( icon . ac ) ,
135+ chalk . yellow ( icon . ac ) ,
136+ chalk . red ( icon . ac )
142137 ] ;
143138
144139 const N_MONTHS = 12 ;
@@ -192,15 +187,15 @@ function showCal() {
192187 if ( idx === 0 && d . month ( ) % 2 ) icon = chalk . gray ( icon ) ;
193188 line . push ( icon ) ;
194189 }
195- log . info ( line . join ( '' ) ) ;
190+ log . info ( line . join ( ' ' ) ) ;
196191 }
197192
198193 log . info ( ) ;
199- log . printf ( '%7s %s%3s%s%3s%s%3s%s' ,
200- ' ' , ICONS [ 1 ] + ' 1~5' ,
201- ' ' , ICONS [ 2 ] + ' 6~10' ,
202- ' ' , ICONS [ 3 ] + ' 11~15' ,
203- ' ' , ICONS [ 4 ] + ' 16+' ) ;
194+ log . printf ( '%8s %s%3s%s%3s%s%3s%s' ,
195+ ' ' , ICONS [ 1 ] + ' 1~5' ,
196+ ' ' , ICONS [ 2 ] + ' 6~10' ,
197+ ' ' , ICONS [ 3 ] + ' 11~15' ,
198+ ' ' , ICONS [ 4 ] + ' 16+' ) ;
204199}
205200
206201cmd . handler = function ( argv ) {
0 commit comments