File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change 11/* eslint-disable no-useless-escape */
22/* eslint-disable no-undef */
33/* eslint-disable no-unused-vars */
4+ const { MAX_REPOS_PER_CHART } = require ( '../../src/config' ) ;
5+
46const sum = ( array ) => {
57 if ( array . length === 0 ) {
68 return 0 ;
@@ -56,7 +58,7 @@ const chart = ({ limit, singleColor }) => {
5658 }
5759 const labels = keys . slice ( 0 , limit ) ;
5860 const data = values . slice ( 0 , limit ) ;
59- if ( keys . length > 20 ) {
61+ if ( keys . length > MAX_REPOS_PER_CHART ) {
6062 const valueOthers = sum ( values . slice ( limit , keys . length ) ) ;
6163 labels . push ( 'Others' ) ;
6264 data . push ( valueOthers ) ;
@@ -133,7 +135,7 @@ const chart = ({ limit, singleColor }) => {
133135const toggleColor = ( ) => {
134136 window . chart . destroy ( ) ;
135137 // eslint-disable-next-line no-undef
136- singleColor = chart ( { limit : 20 , singleColor : ! singleColor } ) ;
138+ singleColor = chart ( { limit : MAX_REPOS_PER_CHART , singleColor : ! singleColor } ) ;
137139 const btn = document . getElementById ( 'btn-toggle' ) ;
138140
139141 btn . classList . toggle ( 'active' ) ;
Original file line number Diff line number Diff line change @@ -137,6 +137,7 @@ exports.index = async (req, res) => {
137137 } ) ;
138138 } )
139139 . catch ( ( err ) => {
140+ // handle rate limit error here
140141 if ( err . response . data . message === 'Not Found' ) {
141142 res . render ( 'layouts/main' , {
142143 ..._ . defaults ( { msg : 'User was not found' } , defaultRenderValue )
You can’t perform that action at this time.
0 commit comments