MCPcopy Create free account
hub / github.com/chatmail/core / get_securejoin_source_stats

Function get_securejoin_source_stats

src/stats.rs:795–819  ·  view source on GitHub ↗
(context: &Context)

Source from the content-addressed store, hash-verified

793}
794
795async fn get_securejoin_source_stats(context: &Context) -> Result<SecurejoinSources> {
796 let map: BTreeMap<SecurejoinSource, u32> = context
797 .sql
798 .query_map_collect(
799 "SELECT source, count FROM stats_securejoin_sources",
800 (),
801 |row| {
802 let source: SecurejoinSource = row.get(0)?;
803 let count: u32 = row.get(1)?;
804 Ok((source, count))
805 },
806 )
807 .await?;
808
809 let stats = SecurejoinSources {
810 unknown: *map.get(&SecurejoinSource::Unknown).unwrap_or(&0),
811 external_link: *map.get(&SecurejoinSource::ExternalLink).unwrap_or(&0),
812 internal_link: *map.get(&SecurejoinSource::InternalLink).unwrap_or(&0),
813 clipboard: *map.get(&SecurejoinSource::Clipboard).unwrap_or(&0),
814 image_loaded: *map.get(&SecurejoinSource::ImageLoaded).unwrap_or(&0),
815 scan: *map.get(&SecurejoinSource::Scan).unwrap_or(&0),
816 };
817
818 Ok(stats)
819}
820
821async fn get_securejoin_uipath_stats(context: &Context) -> Result<SecurejoinUiPaths> {
822 let map: BTreeMap<SecurejoinUiPath, u32> = context

Callers 1

get_statsFunction · 0.85

Calls 2

query_map_collectMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected