pub async fn sync_group(
        &mut self,
        group_id: String,
        filters: Filters,
        search: bool,
        fuzzy: bool,
    ) -> color_eyre::Result<()> {
        let mut annotations = self
            .filter_annotations(filters, Some(group_id.to_owned()))
            .await?;
        if search || fuzzy {
            // Run a search window.
            let annotation_ids = self.search_group(&annotations, fuzzy)?;
            annotations = annotations
                .into_iter()
                .filter(|a| annotation_ids.contains(&a.id))
                .collect();
        }
        let num = annotations.len();
        // Change the group ID attached to each annotation
        self.api
            .update_annotations(
                &annotations
                    .into_iter()
                    .map(|mut a| {
                        a.group = group_id.to_owned();
                        a
                    })
                    .collect::<Vec<_>>(),
            )
            .await?;
        if num > 0 {
            self.sync().await?;
        }
        Ok(())
    }
/// Move (optionally filtered) annotations from a different group to the group gooseberry looks at (set in config)
Move (optionally filtered) annotations from a different group to the group gooseberry looks at (set in config)
Move ( optionally filtered ) annotations from a different group to the group gooseberry looks at ( set in config )
pub async fn sync_group(
        &mut self,
        group_id: String,
        filters: Filters,
        search: bool,
        fuzzy: bool,
    ) -> color_eyre::Result<()> {
        let mut annotations = self
            .filter_annotations(filters, Some(group_id.to_owned()))
            .await?;
        if search || fuzzy {
            // Run a search window.
            let annotation_ids = self.search_group(&annotations, fuzzy)?;
            annotations = annotations
                .into_iter()
                .filter(|a| annotation_ids.contains(&a.id))
                .collect();
        }
        let num = annotations.len();
        // Change the group ID attached to each annotation
        self.api
            .update_annotations(
                &annotations
                    .into_iter()
                    .map(|mut a| {
                        a.group = group_id.to_owned();
                        a
                    })
                    .collect::<Vec<_>>(),
            )
            .await?;
        if num > 0 {
            self.sync().await?;
        }
        Ok(())
    }
pub async fn sync_group ( & mut self , group_id : String , filters : Filters , search : bool , fuzzy : bool , ) -> color_eyre :: Result < ( ) > { let mut annotations = self . filter_annotations ( filters , Some ( group_id . to_owned ( ) ) ) . await ? ; if search || fuzzy { // Run a search window. let annotation_ids = self . search_group ( & annotations , fuzzy ) ? ; annotations = annotations . into_iter ( ) . filter ( | a | annotation_ids . contains ( & a . id ) ) . collect ( ) ; } let num = annotations . len ( ) ; // Change the group ID attached to each annotation self . api . update_annotations ( & annotations . into_iter ( ) . map ( | mut a | { a . group = group_id . to_owned ( ) ; a } ) . collect :: < Vec < _ > > ( ) , ) . await ? ; if num > 0 { self . sync ( ) . await ? ; } Ok ( ( ) ) }
Move (optionally filtered) annotations from a different group to the group gooseberry looks at (set in config)
Move ( optionally filtered ) annotations from a different group to the group gooseberry looks at ( set in config )
&mut self
group_id
String
filters
Filters
search
bool
fuzzy
bool
&mut self
group_id
String
filters
Filters
search
bool
fuzzy
bool