@@ -14,7 +14,6 @@ function runScript() {
14
14
body : {
15
15
key : API_KEY ,
16
16
station_id : STATION_PROFILE_ID ,
17
- fetchfromid : 0
18
17
} ,
19
18
timeout : 15000
20
19
} ;
@@ -30,16 +29,34 @@ function runScript() {
30
29
}
31
30
32
31
// The new API now returns pre-aggregated QSO statistics.
33
- const totalQso = body . total_qso ;
34
- const totalQsoYear = body . total_qso_year ;
35
- const ssbCount = body . ssb_qso ;
36
- const fmCount = body . fm_qso ;
37
- const rttyCount = body . rtty_qso ;
38
- const ft8ft4Count = body . ft8ft4_qso ;
39
- const pskCount = body . psk_qso ;
40
- const cwCount = body . cw_qso ;
41
- const js8Count = body . js8_qso ;
42
- const digiCount = body . digi_qso ;
32
+ let totalQso = body . statistics . totalalltime [ 0 ] . count ;
33
+ let totalQsoYear = body . statistics . totalthisyear [ 0 ] . count ;
34
+ let ssbCount = 0 , fmCount = 0 , rttyCount = 0 , ft8ft4Count = 0 ;
35
+ let pskCount = 0 , cwCount = 0 , js8Count = 0 , digiCount = 0 ;
36
+
37
+ const digi_modes = [ 'FT8' , 'FT4' , 'PSK' , 'RTTY' , 'JS8' , 'JT65' , 'JT9' , 'OLIVIA' , 'CONTESTI' , 'ROS' ] ; // Add more as needed
38
+
39
+ if ( body . statistics . totalgroupedmodes ) {
40
+ body . statistics . totalgroupedmodes . forEach ( mode => {
41
+ const col_mode = mode . col_mode ;
42
+ const col_submode = mode . col_submode || '' ;
43
+
44
+ if ( col_mode === 'SSB' ) ssbCount += Number ( mode . count ) ;
45
+ if ( col_mode === 'FM' ) fmCount += Number ( mode . count ) ;
46
+ if ( col_mode === 'RTTY' ) rttyCount += Number ( mode . count ) ;
47
+ if ( col_mode === 'CW' ) cwCount += Number ( mode . count ) ;
48
+ if ( col_mode === 'PSK' || col_submode . startsWith ( 'PSK' ) ) pskCount += Number ( mode . count ) ;
49
+ if ( col_mode === 'JS8' ) js8Count += Number ( mode . count ) ;
50
+ if ( col_mode === 'FT8' || col_submode === 'FT4' ) ft8ft4Count += Number ( mode . count ) ;
51
+
52
+ // Digital modes total
53
+ digi_modes . forEach ( digi => {
54
+ if ( col_mode . startsWith ( digi ) || col_submode . startsWith ( digi ) ) {
55
+ digiCount += Number ( mode . count ) ;
56
+ }
57
+ } ) ;
58
+ } ) ;
59
+ }
43
60
44
61
console . log ( `Total QSOs: ${ totalQso } , This Year: ${ totalQsoYear } , SSB: ${ ssbCount } , FM: ${ fmCount } , RTTY: ${ rttyCount } , FT8+FT4: ${ ft8ft4Count } , PSK: ${ pskCount } , CW: ${ cwCount } , JS8: ${ js8Count } , Digi: ${ digiCount } ` ) ;
45
62
0 commit comments