@@ -64,6 +64,7 @@ async function loadAndRender(type, value, timeIntervalLabel) {
6464
6565 // render stats
6666 renderGeneralStatistics ( stats , timeIntervalLabel ) ;
67+ renderBusFactor ( stats ) ;
6768 renderWeeklyCommitTypes ( stats . commit_type . commit_type_by_week ) ;
6869
6970 renderInsDelLinesByAuthors ( stats . authors_statistics . authors ) ;
@@ -158,6 +159,24 @@ function renderGeneralStatistics(stats, rangeLabel) {
158159 ` ;
159160}
160161
162+ function renderBusFactor ( stats ) {
163+ const busFactorEl = document . getElementById ( "busFactor" ) ;
164+ busFactorVal = stats . post_data . bus_factor ;
165+
166+ let colorClass = "text-success" ;
167+ if ( busFactorVal === 1 ) {
168+ colorClass = "text-danger" ;
169+ } else if ( busFactorVal === 2 ) {
170+ colorClass = "text-warning" ;
171+ }
172+
173+ busFactorEl . innerHTML = `
174+ <div class="d-flex align-items-center justify-content-center h-100">
175+ <strong class="h1 ${ colorClass } ">${ busFactorVal } </strong>
176+ </div>
177+ ` ;
178+ }
179+
161180function renderChart ( id , config ) {
162181 if ( CHARTS [ id ] ) {
163182 CHARTS [ id ] . destroy ( ) ;
@@ -284,7 +303,7 @@ function buildHourByAuthorChart(hourOfDayData) {
284303 return Object . values ( byAuthor ) . reduce ( ( s , v ) => s + v , 0 ) ;
285304 } ) ;
286305
287- renderChart ( "chartDay " , {
306+ renderChart ( "chartCommitsByHour " , {
288307 type : "bar" ,
289308 data : { labels : HOUR_LABELS , datasets : [ {
290309 label : "Total" ,
@@ -315,7 +334,7 @@ function buildHourByAuthorChart(hourOfDayData) {
315334 backgroundColor : getAuthorColor ( author ) ,
316335 } ) ) ;
317336
318- renderChart ( "chartDay " , {
337+ renderChart ( "chartCommitsByHour " , {
319338 type : "bar" ,
320339 data : { labels : HOUR_LABELS , datasets } ,
321340 options : {
@@ -378,7 +397,7 @@ function buildWeekByAuthorChart(dayOfWeekData) {
378397 Object . values ( dayOfWeekData [ d ] || { } ) . reduce ( ( s , v ) => s + v , 0 )
379398 ) ;
380399
381- renderChart ( "chartWeek " , {
400+ renderChart ( "chartCommitsByWeekday " , {
382401 type : "bar" ,
383402 data : {
384403 labels : WEEK_LABELS ,
@@ -412,7 +431,7 @@ function buildWeekByAuthorChart(dayOfWeekData) {
412431 backgroundColor : getAuthorColor ( author ) ,
413432 } ) ) ;
414433
415- renderChart ( "chartWeek " , {
434+ renderChart ( "chartCommitsByWeekday " , {
416435 type : "bar" ,
417436 data : { labels : WEEK_LABELS , datasets } ,
418437 options : {
@@ -446,7 +465,7 @@ function buildDayOfMonthByAuthorChart(dayOfMonthData) {
446465 Object . values ( dayOfMonthData [ d ] || { } ) . reduce ( ( s , v ) => s + v , 0 )
447466 ) ;
448467
449- renderChart ( "chartMonth " , {
468+ renderChart ( "chartCommitsByDayOfMonth " , {
450469 type : "bar" ,
451470 data : {
452471 labels : DAY_LABELS ,
@@ -480,7 +499,7 @@ function buildDayOfMonthByAuthorChart(dayOfMonthData) {
480499 backgroundColor : getAuthorColor ( author ) ,
481500 } ) ) ;
482501
483- renderChart ( "chartMonth " , {
502+ renderChart ( "chartCommitsByDayOfMonth " , {
484503 type : "bar" ,
485504 data : { labels : DAY_LABELS , datasets } ,
486505 options : {
0 commit comments