@@ -118,17 +118,17 @@ export class StatsCommandHandler implements SlashCommandHandler {
118118 const processedCount = stats . processedCount ;
119119 const pendingCount = stats . pendingCount ;
120120 const failedCount = stats . failedCount ;
121- const successRate = totalLinks > 0 ? ( ( processedCount / totalLinks ) * 100 ) . toFixed ( 1 ) : "0.0" ;
121+ const successRate = totalLinks > 0 ? ( ( processedCount / totalLinks ) * 100 ) : 0 ;
122+ const failureRate = totalLinks > 0 ? ( ( failedCount / totalLinks ) * 100 ) : 0 ;
122123
123124 const lines : string [ ] = [ ] ;
124125 lines . push ( "📊 OpenBrain statistics" ) ;
125126 lines . push ( "" ) ;
126127 lines . push ( `**Totals**` ) ;
127128 lines . push ( `- Total links: ${ totalLinks . toLocaleString ( ) } ` ) ;
128- lines . push ( `- Processed: ${ processedCount . toLocaleString ( ) } ` ) ;
129+ lines . push ( `- Processed: ${ processedCount . toLocaleString ( ) } ( ${ successRate . toFixed ( 1 ) } %) ` ) ;
129130 lines . push ( `- Pending: ${ pendingCount . toLocaleString ( ) } ` ) ;
130- lines . push ( `- Failed: ${ failedCount . toLocaleString ( ) } ` ) ;
131- lines . push ( `- Success rate: ${ successRate } %` ) ;
131+ lines . push ( `- Failed: ${ failedCount . toLocaleString ( ) } (${ failureRate . toFixed ( 1 ) } %)` ) ;
132132
133133 // Attempt to render time-based breakdown if available. Support multiple
134134 // possible field namings (timeBased, time_based, timebased).
@@ -150,9 +150,18 @@ export class StatsCommandHandler implements SlashCommandHandler {
150150 if ( last24 !== undefined || last7 !== undefined || last30 !== undefined ) {
151151 lines . push ( "" ) ;
152152 lines . push ( `**By time**` ) ;
153- if ( last24 !== undefined ) lines . push ( `- Last 24 hours: ${ last24 . toLocaleString ( ) } ` ) ;
154- if ( last7 !== undefined ) lines . push ( `- Last 7 days: ${ last7 . toLocaleString ( ) } ` ) ;
155- if ( last30 !== undefined ) lines . push ( `- Last 30 days: ${ last30 . toLocaleString ( ) } ` ) ;
153+ if ( last24 !== undefined ) {
154+ const pct = totalLinks > 0 ? ( ( last24 / totalLinks ) * 100 ) . toFixed ( 1 ) : "0.0" ;
155+ lines . push ( `- Last 24 hours: ${ last24 . toLocaleString ( ) } (${ pct } %)` ) ;
156+ }
157+ if ( last7 !== undefined ) {
158+ const pct = totalLinks > 0 ? ( ( last7 / totalLinks ) * 100 ) . toFixed ( 1 ) : "0.0" ;
159+ lines . push ( `- Last 7 days: ${ last7 . toLocaleString ( ) } (${ pct } %)` ) ;
160+ }
161+ if ( last30 !== undefined ) {
162+ const pct = totalLinks > 0 ? ( ( last30 / totalLinks ) * 100 ) . toFixed ( 1 ) : "0.0" ;
163+ lines . push ( `- Last 30 days: ${ last30 . toLocaleString ( ) } (${ pct } %)` ) ;
164+ }
156165 }
157166 }
158167
0 commit comments