fn load_parties(&self,ecode:usize) -> anyhow::Result<Vec<Party>> {
        let path = self.find_raw_data_file("Groups.txt")?;
        let mut res = vec![];
        #[derive(Deserialize)]
        struct GroupsRecord {
            ecode: usize,
            pcode : String,
            pname : String,
            pabbrev : String,
            // cands : usize,
        }
        let mut rdr = csv::Reader::from_path(path)?;
        for result in rdr.deserialize() {
            let record : GroupsRecord = result?;
            if record.ecode == ecode {
                res.push(Party{
                    column_id: record.pcode,
                    name: record.pname,
                    abbreviation: Some(record.pabbrev),
                    atl_allowed: false,
                    candidates: vec![],
                    tickets: vec![]
                })
            }
        }
        Ok(res)
    }
/// Get parties (without list of candidates)
Get parties (without list of candidates)
Get parties ( without list of candidates )
fn load_parties(&self,ecode:usize) -> anyhow::Result<Vec<Party>> {
        let path = self.find_raw_data_file("Groups.txt")?;
        let mut res = vec![];
        #[derive(Deserialize)]
        struct GroupsRecord {
            ecode: usize,
            pcode : String,
            pname : String,
            pabbrev : String,
            // cands : usize,
        }
        let mut rdr = csv::Reader::from_path(path)?;
        for result in rdr.deserialize() {
            let record : GroupsRecord = result?;
            if record.ecode == ecode {
                res.push(Party{
                    column_id: record.pcode,
                    name: record.pname,
                    abbreviation: Some(record.pabbrev),
                    atl_allowed: false,
                    candidates: vec![],
                    tickets: vec![]
                })
            }
        }
        Ok(res)
    }
fn load_parties ( & self , ecode : usize ) -> anyhow :: Result < Vec < Party > > { let path = self . find_raw_data_file ( " " ) ? ; let mut res = vec ! [ ] ; # [ derive ( Deserialize ) ] struct GroupsRecord { ecode : usize , pcode : String , pname : String , pabbrev : String , // cands : usize, } let mut rdr = csv :: Reader :: from_path ( path ) ? ; for result in rdr . deserialize ( ) { let record : GroupsRecord = result ? ; if record . ecode == ecode { res . push ( Party { column_id : record . pcode , name : record . pname , abbreviation : Some ( record . pabbrev ) , atl_allowed : false , candidates : vec ! [ ] , tickets : vec ! [ ] } ) } } Ok ( res ) }
Get parties (without list of candidates)
Get parties ( without list of candidates )
&self
ecode
usize
&self
ecode
usize