@@ -59,12 +59,14 @@ const DevelopmentFeed = (() => {
5959 return ;
6060 }
6161
62+ const watchers = Number . isFinite ( Number ( repo . subscribers_count ) ) ? Number ( repo . subscribers_count ) : 0 ;
63+
6264 node . innerHTML = `
6365 <div class="dev-stat-grid">
6466 <div class="dev-stat"><span class="dev-stat-label">Stars</span><span class="dev-stat-value">${ DocsHelpers . compactNumber ( repo . stargazers_count ) } </span></div>
6567 <div class="dev-stat"><span class="dev-stat-label">Forks</span><span class="dev-stat-value">${ DocsHelpers . compactNumber ( repo . forks_count ) } </span></div>
6668 <div class="dev-stat"><span class="dev-stat-label">Open Issues</span><span class="dev-stat-value">${ DocsHelpers . compactNumber ( repo . open_issues_count ) } </span></div>
67- <div class="dev-stat"><span class="dev-stat-label">Watchers</span><span class="dev-stat-value">${ DocsHelpers . compactNumber ( repo . subscribers_count || repo . watchers_count ) } </span></div>
69+ <div class="dev-stat"><span class="dev-stat-label">Watchers</span><span class="dev-stat-value">${ DocsHelpers . compactNumber ( watchers ) } </span></div>
6870 </div>
6971 <div class="dev-snapshot-grid">
7072 <div class="dev-snapshot-card">
@@ -85,23 +87,7 @@ const DevelopmentFeed = (() => {
8587 }
8688
8789 function buildCommitSeries ( commits , days = 5 ) {
88- const buckets = [ ] ;
8990 const counts = new Map ( ) ;
90- const today = new Date ( ) ;
91-
92- for ( let offset = days - 1 ; offset >= 0 ; offset -= 1 ) {
93- const date = new Date ( today ) ;
94- date . setHours ( 0 , 0 , 0 , 0 ) ;
95- date . setDate ( date . getDate ( ) - offset ) ;
96- const key = date . toISOString ( ) . slice ( 0 , 10 ) ;
97- buckets . push ( {
98- key,
99- label : date . toLocaleDateString ( undefined , { weekday : "short" } ) ,
100- fullLabel : date . toLocaleDateString ( undefined , { month : "short" , day : "numeric" } ) ,
101- count : 0
102- } ) ;
103- counts . set ( key , 0 ) ;
104- }
10591
10692 commits . forEach ( ( commit ) => {
10793 const date = commit . commit ?. author ?. date ;
@@ -110,15 +96,28 @@ const DevelopmentFeed = (() => {
11096 }
11197
11298 const key = new Date ( date ) . toISOString ( ) . slice ( 0 , 10 ) ;
113- if ( counts . has ( key ) ) {
114- counts . set ( key , counts . get ( key ) + 1 ) ;
115- }
99+ counts . set ( key , ( counts . get ( key ) || 0 ) + 1 ) ;
116100 } ) ;
117101
118- return buckets . map ( ( bucket ) => ( {
119- ...bucket ,
120- count : counts . get ( bucket . key ) || 0
121- } ) ) ;
102+ const recentDays = Array . from ( counts . keys ( ) )
103+ . sort ( ( left , right ) => new Date ( left ) - new Date ( right ) )
104+ . slice ( - days ) ;
105+
106+ if ( recentDays . length === 0 ) {
107+ const today = new Date ( ) ;
108+ today . setHours ( 0 , 0 , 0 , 0 ) ;
109+ recentDays . push ( today . toISOString ( ) . slice ( 0 , 10 ) ) ;
110+ }
111+
112+ return recentDays . map ( ( key ) => {
113+ const date = new Date ( key ) ;
114+ return {
115+ key,
116+ label : date . toLocaleDateString ( undefined , { weekday : "short" } ) ,
117+ fullLabel : date . toLocaleDateString ( undefined , { month : "short" , day : "numeric" } ) ,
118+ count : counts . get ( key ) || 0
119+ } ;
120+ } ) ;
122121 }
123122
124123 function chartPath ( points ) {
0 commit comments