@@ -5,7 +5,10 @@ function fetch_error_handler(fetch, username, last_cache) {
5
5
return new Promise ( ( resolve , reject ) => {
6
6
const timeoutID = setTimeout ( function ( ) {
7
7
const res = last_cache . get ( username ) ;
8
- if ( res != null ) resolve ( res ) ;
8
+ if ( res != null ) {
9
+ console . log ( "Using cached data for" , username ) ;
10
+ resolve ( res ) ;
11
+ }
9
12
else reject ( { status : 500 , error : "Codeforces Server Error" } ) ;
10
13
} , 2000 ) ;
11
14
fetch ( )
@@ -52,6 +55,7 @@ export function get_rating(username, cache_seconds) {
52
55
resolve ( res ) ;
53
56
} )
54
57
. catch ( ( error ) => {
58
+ console . error ( error ) ;
55
59
if ( error . response . status === 400 )
56
60
reject ( { status : 400 , error : "Codeforces Handle Not Found" } ) ;
57
61
else reject ( { status : 500 , error : "Codeforces Server Error" } ) ;
@@ -98,6 +102,7 @@ export function get_stats(username, cache_seconds) {
98
102
. replace ( "undefined" , "" )
99
103
. trim ( ) ;
100
104
const contestsCount = responses [ 1 ] . data . result . length ;
105
+ const submissions = responses [ 2 ] . data . result . length ;
101
106
const problemsSolved = count_submissions ( responses [ 2 ] . data . result ) ;
102
107
103
108
const res = {
@@ -109,6 +114,7 @@ export function get_stats(username, cache_seconds) {
109
114
maxRank,
110
115
contestsCount,
111
116
problemsSolved,
117
+ submissions,
112
118
friendOfCount,
113
119
contribution,
114
120
} ;
@@ -117,6 +123,7 @@ export function get_stats(username, cache_seconds) {
117
123
resolve ( res ) ;
118
124
} )
119
125
. catch ( ( error ) => {
126
+ console . error ( error ) ;
120
127
if ( error . response . status === 400 )
121
128
reject ( { status : 400 , error : "Codeforces Handle Not Found" } ) ;
122
129
else reject ( { status : 500 , error : "Codeforces Server Error" } ) ;
0 commit comments