@@ -33,9 +33,9 @@ struct Statistics {
33
33
contact_stats : Vec < ContactStat > ,
34
34
message_stats_one_one : MessageStats ,
35
35
message_stats_multi_user : MessageStats ,
36
- securejoin_source_stats : SecurejoinSourceStats ,
37
- securejoin_uipath_stats : SecurejoinUIPathStats ,
38
- securejoin_invites_stats : Vec < JoinedInvite > ,
36
+ securejoin_sources : SecurejoinSources ,
37
+ securejoin_uipaths : SecurejoinUIPaths ,
38
+ securejoin_invites : Vec < JoinedInvite > ,
39
39
}
40
40
41
41
#[ derive( Serialize , PartialEq ) ]
@@ -84,7 +84,7 @@ enum SecurejoinSource {
84
84
}
85
85
86
86
#[ derive( Serialize ) ]
87
- struct SecurejoinSourceStats {
87
+ struct SecurejoinSources {
88
88
unknown : u32 ,
89
89
external_link : u32 ,
90
90
internal_link : u32 ,
@@ -101,7 +101,7 @@ enum SecurejoinUIPath {
101
101
}
102
102
103
103
#[ derive( Serialize ) ]
104
- struct SecurejoinUIPathStats {
104
+ struct SecurejoinUIPaths {
105
105
other : u32 ,
106
106
qr_icon : u32 ,
107
107
new_contact : u32 ,
@@ -155,7 +155,7 @@ See TODO[blog post] for more information."
155
155
Some ( "text/plain" ) ,
156
156
) ?;
157
157
158
- crate :: chat:: send_msg ( context, chat_id, & mut msg)
158
+ chat:: send_msg ( context, chat_id, & mut msg)
159
159
. await
160
160
. context ( "Failed to send statistics message" )
161
161
. log_err ( context)
@@ -240,9 +240,9 @@ async fn get_statistics(context: &Context) -> Result<String> {
240
240
contact_stats : get_contact_stats ( context, last_old_contact) . await ?,
241
241
message_stats_one_one : get_message_stats ( context, last_excluded_msg, true ) . await ?,
242
242
message_stats_multi_user : get_message_stats ( context, last_excluded_msg, false ) . await ?,
243
- securejoin_source_stats : get_securejoin_source_stats ( context) . await ?,
244
- securejoin_uipath_stats : get_securejoin_uipath_stats ( context) . await ?,
245
- securejoin_invites_stats : get_securejoin_invite_stats ( context) . await ?,
243
+ securejoin_sources : get_securejoin_source_stats ( context) . await ?,
244
+ securejoin_uipaths : get_securejoin_uipath_stats ( context) . await ?,
245
+ securejoin_invites : get_securejoin_invite_stats ( context) . await ?,
246
246
} ;
247
247
248
248
Ok ( serde_json:: to_string_pretty ( & statistics) ?)
@@ -556,7 +556,7 @@ pub(crate) async fn count_securejoin_source(
556
556
context
557
557
. sql
558
558
. execute (
559
- "INSERT INTO stats_securejoin_sources VALUES (?, 1)
559
+ "INSERT INTO statistics_securejoin_sources VALUES (?, 1)
560
560
ON CONFLICT (source) DO UPDATE SET count=count+1;" ,
561
561
( source, ) ,
562
562
)
@@ -569,19 +569,19 @@ pub(crate) async fn count_securejoin_source(
569
569
context
570
570
. sql
571
571
. execute (
572
- "INSERT INTO stats_securejoin_uipaths VALUES (?, 1)
572
+ "INSERT INTO statistics_securejoin_uipaths VALUES (?, 1)
573
573
ON CONFLICT (uipath) DO UPDATE SET count=count+1;" ,
574
574
( uipath, ) ,
575
575
)
576
576
. await ?;
577
577
Ok ( ( ) )
578
578
}
579
579
580
- async fn get_securejoin_source_stats ( context : & Context ) -> Result < SecurejoinSourceStats > {
580
+ async fn get_securejoin_source_stats ( context : & Context ) -> Result < SecurejoinSources > {
581
581
let map = context
582
582
. sql
583
583
. query_map (
584
- "SELECT source, count FROM stats_securejoin_sources " ,
584
+ "SELECT source, count FROM statistics_securejoin_sources " ,
585
585
( ) ,
586
586
|row| {
587
587
let source: SecurejoinSource = row. get ( 0 ) ?;
@@ -592,7 +592,7 @@ async fn get_securejoin_source_stats(context: &Context) -> Result<SecurejoinSour
592
592
)
593
593
. await ?;
594
594
595
- let stats = SecurejoinSourceStats {
595
+ let stats = SecurejoinSources {
596
596
unknown : * map. get ( & SecurejoinSource :: Unknown ) . unwrap_or ( & 0 ) ,
597
597
external_link : * map. get ( & SecurejoinSource :: ExternalLink ) . unwrap_or ( & 0 ) ,
598
598
internal_link : * map. get ( & SecurejoinSource :: InternalLink ) . unwrap_or ( & 0 ) ,
@@ -604,11 +604,11 @@ async fn get_securejoin_source_stats(context: &Context) -> Result<SecurejoinSour
604
604
Ok ( stats)
605
605
}
606
606
607
- async fn get_securejoin_uipath_stats ( context : & Context ) -> Result < SecurejoinUIPathStats > {
607
+ async fn get_securejoin_uipath_stats ( context : & Context ) -> Result < SecurejoinUIPaths > {
608
608
let map = context
609
609
. sql
610
610
. query_map (
611
- "SELECT uipath, count FROM stats_securejoin_uipaths " ,
611
+ "SELECT uipath, count FROM statistics_securejoin_uipaths " ,
612
612
( ) ,
613
613
|row| {
614
614
let uipath: SecurejoinUIPath = row. get ( 0 ) ?;
@@ -619,7 +619,7 @@ async fn get_securejoin_uipath_stats(context: &Context) -> Result<SecurejoinUIPa
619
619
)
620
620
. await ?;
621
621
622
- let stats = SecurejoinUIPathStats {
622
+ let stats = SecurejoinUIPaths {
623
623
other : * map. get ( & SecurejoinUIPath :: Unknown ) . unwrap_or ( & 0 ) ,
624
624
qr_icon : * map. get ( & SecurejoinUIPath :: QrIcon ) . unwrap_or ( & 0 ) ,
625
625
new_contact : * map. get ( & SecurejoinUIPath :: NewContact ) . unwrap_or ( & 0 ) ,
@@ -653,7 +653,7 @@ pub(crate) async fn count_securejoin_invite(context: &Context, invite: &QrInvite
653
653
context
654
654
. sql
655
655
. execute (
656
- "INSERT INTO stats_securejoin_invites (contact_created, already_verified, type)
656
+ "INSERT INTO statistics_securejoin_invites (contact_created, already_verified, type)
657
657
VALUES (?, ?, ?)" ,
658
658
( contact_created, already_verified, typ) ,
659
659
)
@@ -683,7 +683,7 @@ async fn get_securejoin_invite_stats(context: &Context) -> Result<Vec<JoinedInvi
683
683
let qr_scans: Vec < JoinedInvite > = context
684
684
. sql
685
685
. query_map (
686
- "SELECT contact_created, already_verified, type FROM stats_securejoin_invites " ,
686
+ "SELECT contact_created, already_verified, type FROM statistics_securejoin_invites " ,
687
687
( ) ,
688
688
|row| {
689
689
let contact_created: bool = row. get ( 0 ) ?;
0 commit comments