feat: Added optional vote comment to the proposal vote fields
This commit is contained in:
		@@ -48,7 +48,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    engine.register_fn("create_vote_option", |id: i64, text: String| {
 | 
			
		||||
        VoteOption::new(id as u8, text)
 | 
			
		||||
        VoteOption::new(id as u8, text, Some("This is an optional comment"))
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    engine.register_fn(
 | 
			
		||||
@@ -93,7 +93,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
 | 
			
		||||
    engine.register_fn(
 | 
			
		||||
        "add_option_to_proposal",
 | 
			
		||||
        |mut proposal: Proposal, option_id: i64, option_text: String| -> Proposal {
 | 
			
		||||
            proposal.add_option(option_id as u8, option_text)
 | 
			
		||||
            proposal.add_option(
 | 
			
		||||
                option_id as u8,
 | 
			
		||||
                option_text,
 | 
			
		||||
                Some("This is an optional comment".to_string()),
 | 
			
		||||
            )
 | 
			
		||||
        },
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
@@ -229,7 +233,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
 | 
			
		||||
            if index >= 0 && index < proposal.options.len() as i64 {
 | 
			
		||||
                proposal.options[index as usize].clone()
 | 
			
		||||
            } else {
 | 
			
		||||
                VoteOption::new(0, "Invalid Option")
 | 
			
		||||
                VoteOption::new(
 | 
			
		||||
                    0,
 | 
			
		||||
                    "Invalid Option",
 | 
			
		||||
                    Some("This is an invalid option".to_string()),
 | 
			
		||||
                )
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
    );
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user