@@ -69,6 +69,7 @@ async function loadAndRender(type, value, timeIntervalLabel) {
6969 renderInsDelLinesByAuthors ( stats . authors_statistics . authors ) ;
7070 renderCodeChurnByAuthor ( stats . authors_statistics . authors ) ;
7171 renderCommitsByAuthor ( stats . authors_statistics . authors ) ;
72+ renderAccordionAuthors ( stats ) ;
7273 renderAuthorsContributionsTable ( stats . authors_statistics . authors ) ;
7374
7475 buildHourByAuthorChart ( stats . historical_statistics . hour_of_day ) ;
@@ -166,15 +167,23 @@ function renderChart(id, config) {
166167}
167168
168169function renderCommitsByAuthor ( authorsData ) {
170+ const chartName = "chartCommitsByAuthor" ;
169171 const labels = Object . keys ( authorsData ) ;
170172 const dataValues = Object . values ( authorsData ) . map ( a => a . commits ) ;
171173
172- renderChart ( "chartCommitsByAuthor" , {
174+ subRenderCommitsByAuthor ( chartName , labels , dataValues ) ;
175+ }
176+
177+ function subRenderCommitsByAuthor ( chartName , labels , values ) {
178+
179+ console . log ( "Rendering commits by author:" , chartName , labels , values ) ;
180+
181+ renderChart ( chartName , {
173182 type : "pie" ,
174183 data : {
175184 labels : labels ,
176185 datasets : [ {
177- data : dataValues ,
186+ data : values ,
178187 } ]
179188 } ,
180189 options : {
@@ -461,12 +470,16 @@ function buildDayOfMonthByAuthorChart(dayOfMonthData) {
461470}
462471
463472function renderExtensionsHorizontalBar ( filesExtensionsTotal ) {
473+ SubRenderExtensionsHorizontalBar ( "chartExtensions" , filesExtensionsTotal )
474+ }
475+
476+ function SubRenderExtensionsHorizontalBar ( chartName , data ) {
464477 const COLOR_INSERTIONS = "#198754" ;
465478 const COLOR_DELETIONS = "#dc3545" ;
466479
467480 const cleanKey = ( k ) => String ( k ) . trim ( ) . replace ( / } + $ / , "" ) ;
468481
469- const items = Object . entries ( filesExtensionsTotal ) . map ( ( [ ext , v ] ) => {
482+ const items = Object . entries ( data ) . map ( ( [ ext , v ] ) => {
470483 const key = cleanKey ( ext ) || "no_extension" ;
471484 const ins = Number ( v ?. insertions || 0 ) ;
472485 const del = Number ( v ?. deletions || 0 ) ;
@@ -481,7 +494,7 @@ function renderExtensionsHorizontalBar(filesExtensionsTotal) {
481494 const insertions = filtered . map ( it => it . insertions ) ;
482495 const deletions = filtered . map ( it => - Math . abs ( it . deletions ) ) ; // отрицательные
483496
484- renderChart ( "chartExtensions" , {
497+ renderChart ( chartName , {
485498 type : "bar" ,
486499 data : {
487500 labels,
@@ -627,6 +640,53 @@ function renderWeeklyCommitTypes(weeklyCommitTypesData) {
627640 } ) ;
628641}
629642
643+ function renderAccordionAuthors ( stats ) {
644+ const authorsList = Object . keys ( stats . authors_statistics . authors ) . sort ( ) ;
645+
646+ const accordion = document . getElementById ( "accordionAuthors" ) ;
647+
648+ authorsList . forEach ( ( author , index ) => {
649+ const collapseId = `collapse-${ index } ` ;
650+ const chartExtensionsId = `chartExtensions-${ index } ` ;
651+ const chartCommitTypesId = `chartCommitTypes-${ index } ` ;
652+ const chartCommitTypesLabels = Object . keys ( stats . commit_type . author_commit_type_counter [ author ] ) ;
653+ const chartCommitTypesValues = Object . values ( stats . commit_type . author_commit_type_counter [ author ] ) ;
654+
655+ const item = document . createElement ( "div" ) ;
656+ item . className = "accordion-item" ;
657+ item . innerHTML += `
658+ <div class="accordion-item">
659+ <h2 class="accordion-header" id="heading-${ index } ">
660+ <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#${ collapseId } " aria-expanded="false" aria-controls="${ collapseId } ">
661+ ${ author }
662+ </button>
663+ </h2>
664+ <div id="${ collapseId } " class="accordion-collapse collapse" aria-labelledby="heading-${ index } " data-bs-parent="#accordionAuthors">
665+ <div class="accordion-body">
666+ <div class="row">
667+ <div class="col-md-12">
668+ <canvas id="${ chartExtensionsId } "></canvas>
669+ </div>
670+ </div>
671+ <div class="row">
672+ <div class="col-md-4">
673+ <canvas id="${ chartCommitTypesId } "></canvas>
674+ </div>
675+ </div>
676+ </div>
677+ </div>
678+ </div>
679+ ` ;
680+
681+ accordion . appendChild ( item ) ;
682+
683+ setTimeout ( ( ) => {
684+ SubRenderExtensionsHorizontalBar ( chartExtensionsId , stats . language_statistics . files_extensions_by_author [ author ] ) ;
685+ subRenderCommitsByAuthor ( chartCommitTypesId , chartCommitTypesLabels , chartCommitTypesValues )
686+ } , 0 ) ;
687+ } ) ;
688+ }
689+
630690function renderAuthorsContributionsTable ( authorsData ) {
631691 const tbody = document . getElementById ( "authorsContributionsTable" ) ;
632692 tbody . innerHTML = "" ;
0 commit comments